diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln new file mode 100644 index 000000000000..34a2ae3085f2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Language.Text", "src\Azure.AI.Language.Text.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Language.Text.Tests", "tests\Azure.AI.Language.Text.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md new file mode 100644 index 000000000000..13dd08af78ab --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md new file mode 100644 index 000000000000..889fdb32d255 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md @@ -0,0 +1,107 @@ +# Azure.AI.Language.Text client library for .NET + +Azure.AI.Language.Text is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.Language.Text/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.AI.Language.Text --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +### Service API versions + +The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version. + +For example, + +```C# Snippet:CreateClientForSpecificApiVersion +Uri endpoint = new Uri(""); +DefaultAzureCredential credential = new DefaultAzureCredential(); +ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.) +var client = new Client(endpoint, credential, options); +``` + +When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.Language.Text/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/textanalytics/Azure.AI.Language.Text/README.png) diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs new file mode 100644 index 000000000000..2c53519ced72 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs @@ -0,0 +1,3484 @@ +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public int? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + public Azure.AI.Language.Text.SummaryLengthBucket? SummaryLength { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummarizationOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationOperationAction() { } + public Azure.AI.Language.Text.AbstractiveSummarizationActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummarizationOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.AbstractiveSummarizationResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummarizationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummarizationResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummarizationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummary() { } + public System.Collections.Generic.IReadOnlyList Contexts { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummary System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummary System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummaryActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummaryActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Summaries { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummaryActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AbstractiveSummaryActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AgeMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AgeMetadata() { } + public Azure.AI.Language.Text.AgeUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AgeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AgeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AgeUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AgeUnit(string value) { throw null; } + public static Azure.AI.Language.Text.AgeUnit Day { get { throw null; } } + public static Azure.AI.Language.Text.AgeUnit Month { get { throw null; } } + public static Azure.AI.Language.Text.AgeUnit Unspecified { get { throw null; } } + public static Azure.AI.Language.Text.AgeUnit Week { get { throw null; } } + public static Azure.AI.Language.Text.AgeUnit Year { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.AgeUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.AgeUnit left, Azure.AI.Language.Text.AgeUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.AgeUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.AgeUnit left, Azure.AI.Language.Text.AgeUnit right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class AILanguageTextModelFactory + { + public static Azure.AI.Language.Text.AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.AbstractiveSummarizationResult results = null) { throw null; } + public static Azure.AI.Language.Text.AbstractiveSummarizationResult AbstractiveSummarizationResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.AbstractiveSummary AbstractiveSummary(string text = null, System.Collections.Generic.IEnumerable contexts = null) { throw null; } + public static Azure.AI.Language.Text.AbstractiveSummaryActionResult AbstractiveSummaryActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable summaries = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.AgeMetadata AgeMetadata(double value = 0, Azure.AI.Language.Text.AgeUnit unit = default(Azure.AI.Language.Text.AgeUnit)) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextDynamicClassificationResult AnalyzeTextDynamicClassificationResult(Azure.AI.Language.Text.DynamicClassificationResult results = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextEntitiesResult AnalyzeTextEntitiesResult(Azure.AI.Language.Text.EntitiesResult results = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextEntityLinkingResult AnalyzeTextEntityLinkingResult(Azure.AI.Language.Text.EntityLinkingResult results = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextError AnalyzeTextError(Azure.AI.Language.Text.AnalyzeTextErrorCode code = default(Azure.AI.Language.Text.AnalyzeTextErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Text.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextKeyPhraseResult AnalyzeTextKeyPhraseResult(Azure.AI.Language.Text.KeyPhraseResult results = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextLanguageDetectionResult AnalyzeTextLanguageDetectionResult(Azure.AI.Language.Text.LanguageDetectionResult results = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextOperationResult AnalyzeTextOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, string kind = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextOperationState AnalyzeTextOperationState(string displayName = null, System.DateTimeOffset createdAt = default(System.DateTimeOffset), System.DateTimeOffset? expiresOn = default(System.DateTimeOffset?), System.Guid jobId = default(System.Guid), System.DateTimeOffset lastUpdatedAt = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), System.Collections.Generic.IEnumerable errors = null, string nextLink = null, Azure.AI.Language.Text.TextActions actions = null, Azure.AI.Language.Text.RequestStatistics statistics = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextPiiResult AnalyzeTextPiiResult(Azure.AI.Language.Text.PiiResult results = null) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextSentimentResult AnalyzeTextSentimentResult(Azure.AI.Language.Text.SentimentResult results = null) { throw null; } + public static Azure.AI.Language.Text.AreaMetadata AreaMetadata(double value = 0, Azure.AI.Language.Text.AreaUnit unit = default(Azure.AI.Language.Text.AreaUnit)) { throw null; } + public static Azure.AI.Language.Text.ClassificationActionResult ClassificationActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable @class = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.ClassificationResult ClassificationResult(string category = null, double confidenceScore = 0) { throw null; } + public static Azure.AI.Language.Text.CurrencyMetadata CurrencyMetadata(double value = 0, string unit = null, string iso4217 = null) { throw null; } + public static Azure.AI.Language.Text.CustomAbstractiveSummarizationActionContent CustomAbstractiveSummarizationActionContent(int? sentenceCount = default(int?), Azure.AI.Language.Text.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.StringIndexType?), Azure.AI.Language.Text.SummaryLengthBucket? summaryLength = default(Azure.AI.Language.Text.SummaryLengthBucket?), bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.CustomAbstractiveSummarizationOperationAction CustomAbstractiveSummarizationOperationAction(string name = null, Azure.AI.Language.Text.CustomAbstractiveSummarizationActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Text.CustomAbstractiveSummarizationOperationResult CustomAbstractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.CustomAbstractiveSummarizationResult results = null) { throw null; } + public static Azure.AI.Language.Text.CustomAbstractiveSummarizationResult CustomAbstractiveSummarizationResult(System.Collections.Generic.IEnumerable documents = null, System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.CustomEntitiesActionContent CustomEntitiesActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null, Azure.AI.Language.Text.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Text.CustomEntitiesActionResult CustomEntitiesActionResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.CustomEntityRecognitionOperationResult CustomEntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.CustomEntitiesActionResult results = null) { throw null; } + public static Azure.AI.Language.Text.CustomHealthcareActionContent CustomHealthcareActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null, Azure.AI.Language.Text.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Text.CustomHealthcareActionResult CustomHealthcareActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, System.Collections.Generic.IEnumerable relations = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.CustomHealthcareEntity CustomHealthcareEntity(string text = null, Azure.AI.Language.Text.HealthcareEntityCategory category = default(Azure.AI.Language.Text.HealthcareEntityCategory), string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, Azure.AI.Language.Text.HealthcareAssertion assertion = null, string name = null, System.Collections.Generic.IEnumerable links = null, System.Collections.Generic.IEnumerable entityComponentInformation = null) { throw null; } + public static Azure.AI.Language.Text.CustomHealthcareOperationResult CustomHealthcareOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.CustomHealthcareResult results = null) { throw null; } + public static Azure.AI.Language.Text.CustomHealthcareResult CustomHealthcareResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.CustomLabelClassificationActionResult CustomLabelClassificationActionResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.CustomMultiLabelClassificationActionContent CustomMultiLabelClassificationActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.CustomMultiLabelClassificationOperationResult CustomMultiLabelClassificationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.CustomLabelClassificationActionResult results = null) { throw null; } + public static Azure.AI.Language.Text.CustomSentenceSentiment CustomSentenceSentiment(string text = null, Azure.AI.Language.Text.SentenceSentimentValue sentiment = Azure.AI.Language.Text.SentenceSentimentValue.Positive, Azure.AI.Language.Text.SentimentConfidenceScores confidenceScores = null, int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.CustomSentimentAnalysisActionContent CustomSentimentAnalysisActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null, Azure.AI.Language.Text.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Text.CustomSentimentAnalysisOperationResult CustomSentimentAnalysisOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.CustomSentimentAnalysisResult results = null) { throw null; } + public static Azure.AI.Language.Text.CustomSentimentAnalysisResult CustomSentimentAnalysisResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.CustomSentimentAnalysisResultDocument CustomSentimentAnalysisResultDocument(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, Azure.AI.Language.Text.DocumentSentiment sentiment = Azure.AI.Language.Text.DocumentSentiment.Positive, Azure.AI.Language.Text.SentimentConfidenceScores confidenceScores = null, System.Collections.Generic.IEnumerable sentences = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.CustomSingleLabelClassificationActionContent CustomSingleLabelClassificationActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.CustomSingleLabelClassificationOperationResult CustomSingleLabelClassificationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.CustomLabelClassificationActionResult results = null) { throw null; } + public static Azure.AI.Language.Text.DateMetadata DateMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.DateTimeMetadata DateTimeMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.DateValue DateValue(string timex = null, string value = null, Azure.AI.Language.Text.TemporalModifier? modifier = default(Azure.AI.Language.Text.TemporalModifier?)) { throw null; } + public static Azure.AI.Language.Text.DetectedLanguage DetectedLanguage(string name = null, string iso6391Name = null, double confidenceScore = 0, Azure.AI.Language.Text.ScriptKind? script = default(Azure.AI.Language.Text.ScriptKind?), Azure.AI.Language.Text.ScriptCode? scriptCode = default(Azure.AI.Language.Text.ScriptCode?)) { throw null; } + public static Azure.AI.Language.Text.DocumentError DocumentError(string id = null, Azure.AI.Language.Text.AnalyzeTextError error = null) { throw null; } + public static Azure.AI.Language.Text.DocumentStatistics DocumentStatistics(int charactersCount = 0, int transactionsCount = 0) { throw null; } + public static Azure.AI.Language.Text.DocumentWarning DocumentWarning(Azure.AI.Language.Text.WarningCode code = default(Azure.AI.Language.Text.WarningCode), string message = null, string targetRef = null) { throw null; } + public static Azure.AI.Language.Text.DynamicClassificationDocumentResult DynamicClassificationDocumentResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable classifications = null) { throw null; } + public static Azure.AI.Language.Text.DynamicClassificationResult DynamicClassificationResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.EntitiesDocumentResultWithMetadataDetectedLanguage EntitiesDocumentResultWithMetadataDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.EntitiesResult EntitiesResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.EntityActionResult EntityActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.EntityLinkingActionResult EntityLinkingActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.EntityLinkingMatch EntityLinkingMatch(double confidenceScore = 0, string text = null, int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.EntityLinkingOperationResult EntityLinkingOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.EntityLinkingResult results = null) { throw null; } + public static Azure.AI.Language.Text.EntityLinkingResult EntityLinkingResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.EntityRecognitionOperationResult EntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.EntitiesResult results = null) { throw null; } + public static Azure.AI.Language.Text.EntityTag EntityTag(string name = null, double? confidenceScore = default(double?)) { throw null; } + public static Azure.AI.Language.Text.ExtractedSummaryActionResult ExtractedSummaryActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable sentences = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.ExtractedSummarySentence ExtractedSummarySentence(string text = null, double rankScore = 0, int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.ExtractiveSummarizationResult results = null) { throw null; } + public static Azure.AI.Language.Text.ExtractiveSummarizationResult ExtractiveSummarizationResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.FhirBundle FhirBundle(System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } + public static Azure.AI.Language.Text.HealthcareActionResult HealthcareActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, System.Collections.Generic.IEnumerable relations = null, Azure.AI.Language.Text.FhirBundle fhirBundle = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.HealthcareAssertion HealthcareAssertion(Azure.AI.Language.Text.HealthcareAssertionConditionality? conditionality = default(Azure.AI.Language.Text.HealthcareAssertionConditionality?), Azure.AI.Language.Text.HealthcareAssertionCertainty? certainty = default(Azure.AI.Language.Text.HealthcareAssertionCertainty?), Azure.AI.Language.Text.HealthcareAssertionAssociation? association = default(Azure.AI.Language.Text.HealthcareAssertionAssociation?), Azure.AI.Language.Text.HealthcareAssertionTemporality? temporality = default(Azure.AI.Language.Text.HealthcareAssertionTemporality?)) { throw null; } + public static Azure.AI.Language.Text.HealthcareEntity HealthcareEntity(string text = null, Azure.AI.Language.Text.HealthcareEntityCategory category = default(Azure.AI.Language.Text.HealthcareEntityCategory), string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, Azure.AI.Language.Text.HealthcareAssertion assertion = null, string name = null, System.Collections.Generic.IEnumerable links = null) { throw null; } + public static Azure.AI.Language.Text.HealthcareEntityLink HealthcareEntityLink(string dataSource = null, string id = null) { throw null; } + public static Azure.AI.Language.Text.HealthcareOperationResult HealthcareOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.HealthcareResult results = null) { throw null; } + public static Azure.AI.Language.Text.HealthcareRelation HealthcareRelation(Azure.AI.Language.Text.RelationType relationType = default(Azure.AI.Language.Text.RelationType), System.Collections.Generic.IEnumerable entities = null, double? confidenceScore = default(double?)) { throw null; } + public static Azure.AI.Language.Text.HealthcareRelationEntity HealthcareRelationEntity(string @ref = null, string role = null) { throw null; } + public static Azure.AI.Language.Text.HealthcareResult HealthcareResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.InformationMetadata InformationMetadata(double value = 0, Azure.AI.Language.Text.InformationUnit unit = default(Azure.AI.Language.Text.InformationUnit)) { throw null; } + public static Azure.AI.Language.Text.InnerErrorModel InnerErrorModel(Azure.AI.Language.Text.InnerErrorCode code = default(Azure.AI.Language.Text.InnerErrorCode), string message = null, System.Collections.Generic.IReadOnlyDictionary details = null, string target = null, Azure.AI.Language.Text.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Text.KeyPhraseExtractionOperationResult KeyPhraseExtractionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.KeyPhraseResult results = null) { throw null; } + public static Azure.AI.Language.Text.KeyPhraseResult KeyPhraseResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.KeyPhrasesActionResult KeyPhrasesActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable keyPhrases = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.LanguageDetectionDocumentResult LanguageDetectionDocumentResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.LanguageDetectionResult LanguageDetectionResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.LanguageInput LanguageInput(string id = null, string text = null, string countryHint = null) { throw null; } + public static Azure.AI.Language.Text.LearnedComponent LearnedComponent(string value = null) { throw null; } + public static Azure.AI.Language.Text.LengthMetadata LengthMetadata(double value = 0, Azure.AI.Language.Text.LengthUnit unit = default(Azure.AI.Language.Text.LengthUnit)) { throw null; } + public static Azure.AI.Language.Text.LinkedEntity LinkedEntity(string name = null, System.Collections.Generic.IEnumerable matches = null, string language = null, string id = null, string url = null, string dataSource = null, string bingId = null) { throw null; } + public static Azure.AI.Language.Text.ListComponent ListComponent(string value = null) { throw null; } + public static Azure.AI.Language.Text.MultiLanguageInput MultiLanguageInput(string id = null, string text = null, string language = null) { throw null; } + public static Azure.AI.Language.Text.NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0) { throw null; } + public static Azure.AI.Language.Text.NamedEntityWithMetadata NamedEntityWithMetadata(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, string type = null, System.Collections.Generic.IEnumerable tags = null, Azure.AI.Language.Text.BaseMetadata metadata = null) { throw null; } + public static Azure.AI.Language.Text.NumberMetadata NumberMetadata(Azure.AI.Language.Text.NumberKind numberKind = default(Azure.AI.Language.Text.NumberKind), double value = 0) { throw null; } + public static Azure.AI.Language.Text.NumericRangeMetadata NumericRangeMetadata(Azure.AI.Language.Text.RangeKind rangeKind = default(Azure.AI.Language.Text.RangeKind), double minimum = 0, double maximum = 0, Azure.AI.Language.Text.RangeInclusivity? rangeInclusivity = default(Azure.AI.Language.Text.RangeInclusivity?)) { throw null; } + public static Azure.AI.Language.Text.OrdinalMetadata OrdinalMetadata(string offset = null, Azure.AI.Language.Text.RelativeTo relativeTo = default(Azure.AI.Language.Text.RelativeTo), string value = null) { throw null; } + public static Azure.AI.Language.Text.PiiActionResult PiiActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, string redactedText = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.PiiResult results = null) { throw null; } + public static Azure.AI.Language.Text.PiiResult PiiResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.PrebuiltComponent PrebuiltComponent(string value = null) { throw null; } + public static Azure.AI.Language.Text.RequestStatistics RequestStatistics(int documentsCount = 0, int validDocumentsCount = 0, int erroneousDocumentsCount = 0, long transactionsCount = (long)0) { throw null; } + public static Azure.AI.Language.Text.SentenceAssessment SentenceAssessment(Azure.AI.Language.Text.TokenSentiment sentiment = Azure.AI.Language.Text.TokenSentiment.Positive, Azure.AI.Language.Text.TargetConfidenceScoreLabel confidenceScores = null, int offset = 0, int length = 0, string text = null, bool isNegated = false) { throw null; } + public static Azure.AI.Language.Text.SentenceSentiment SentenceSentiment(string text = null, Azure.AI.Language.Text.SentenceSentimentValue sentiment = Azure.AI.Language.Text.SentenceSentimentValue.Positive, Azure.AI.Language.Text.SentimentConfidenceScores confidenceScores = null, int offset = 0, int length = 0, System.Collections.Generic.IEnumerable targets = null, System.Collections.Generic.IEnumerable assessments = null) { throw null; } + public static Azure.AI.Language.Text.SentenceTarget SentenceTarget(Azure.AI.Language.Text.TokenSentiment sentiment = Azure.AI.Language.Text.TokenSentiment.Positive, Azure.AI.Language.Text.TargetConfidenceScoreLabel confidenceScores = null, int offset = 0, int length = 0, string text = null, System.Collections.Generic.IEnumerable relations = null) { throw null; } + public static Azure.AI.Language.Text.SentimentActionResult SentimentActionResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.DocumentStatistics statistics = null, Azure.AI.Language.Text.DocumentSentiment sentiment = Azure.AI.Language.Text.DocumentSentiment.Positive, Azure.AI.Language.Text.SentimentConfidenceScores confidenceScores = null, System.Collections.Generic.IEnumerable sentences = null, Azure.AI.Language.Text.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.SentimentConfidenceScores SentimentConfidenceScores(double positive = 0, double neutral = 0, double negative = 0) { throw null; } + public static Azure.AI.Language.Text.SentimentOperationResult SentimentOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.TextActionState status = default(Azure.AI.Language.Text.TextActionState), string name = null, Azure.AI.Language.Text.SentimentResult results = null) { throw null; } + public static Azure.AI.Language.Text.SentimentResult SentimentResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.SpeedMetadata SpeedMetadata(double value = 0, Azure.AI.Language.Text.SpeedUnit unit = default(Azure.AI.Language.Text.SpeedUnit)) { throw null; } + public static Azure.AI.Language.Text.SummaryContext SummaryContext(int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.TargetConfidenceScoreLabel TargetConfidenceScoreLabel(double positive = 0, double negative = 0) { throw null; } + public static Azure.AI.Language.Text.TargetRelation TargetRelation(string @ref = null, Azure.AI.Language.Text.TargetRelationType relationType = Azure.AI.Language.Text.TargetRelationType.Assessment) { throw null; } + public static Azure.AI.Language.Text.TemperatureMetadata TemperatureMetadata(double value = 0, Azure.AI.Language.Text.TemperatureUnit unit = default(Azure.AI.Language.Text.TemperatureUnit)) { throw null; } + public static Azure.AI.Language.Text.TemporalSetMetadata TemporalSetMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.TemporalSpanMetadata TemporalSpanMetadata(System.Collections.Generic.IEnumerable spanValues = null) { throw null; } + public static Azure.AI.Language.Text.TemporalSpanValues TemporalSpanValues(string begin = null, string end = null, string duration = null, Azure.AI.Language.Text.TemporalModifier? modifier = default(Azure.AI.Language.Text.TemporalModifier?), string timex = null) { throw null; } + public static Azure.AI.Language.Text.TextActions TextActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } + public static Azure.AI.Language.Text.TimeMetadata TimeMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.VolumeMetadata VolumeMetadata(double value = 0, Azure.AI.Language.Text.VolumeUnit unit = default(Azure.AI.Language.Text.VolumeUnit)) { throw null; } + public static Azure.AI.Language.Text.WeightMetadata WeightMetadata(double value = 0, Azure.AI.Language.Text.WeightUnit unit = default(Azure.AI.Language.Text.WeightUnit)) { throw null; } + } + public partial class AllowOverlapEntityPolicyType : Azure.AI.Language.Text.EntityOverlapPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AllowOverlapEntityPolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AllowOverlapEntityPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AllowOverlapEntityPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextDynamicClassificationResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextDynamicClassificationResult() { } + public Azure.AI.Language.Text.DynamicClassificationResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextDynamicClassificationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextDynamicClassificationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextEntitiesResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextEntitiesResult() { } + public Azure.AI.Language.Text.EntitiesResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextEntitiesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextEntitiesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextEntityLinkingResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextEntityLinkingResult() { } + public Azure.AI.Language.Text.EntityLinkingResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextEntityLinkingResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextEntityLinkingResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextError() { } + public Azure.AI.Language.Text.AnalyzeTextErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Details { get { throw null; } } + public Azure.AI.Language.Text.InnerErrorModel Innererror { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AnalyzeTextErrorCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AnalyzeTextErrorCode(string value) { throw null; } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode AzureCognitiveSearchIndexLimitReached { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode AzureCognitiveSearchIndexNotFound { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode Conflict { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode Forbidden { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode InternalServerError { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode InvalidArgument { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode NotFound { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode OperationNotFound { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode ProjectNotFound { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode QuotaExceeded { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode ServiceUnavailable { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode Timeout { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode TooManyRequests { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode Unauthorized { get { throw null; } } + public static Azure.AI.Language.Text.AnalyzeTextErrorCode Warning { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.AnalyzeTextErrorCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.AnalyzeTextErrorCode left, Azure.AI.Language.Text.AnalyzeTextErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.AnalyzeTextErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.AnalyzeTextErrorCode left, Azure.AI.Language.Text.AnalyzeTextErrorCode right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class AnalyzeTextInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextInput() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextKeyPhraseResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextKeyPhraseResult() { } + public Azure.AI.Language.Text.KeyPhraseResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextKeyPhraseResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextKeyPhraseResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextLanguageDetectionResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextLanguageDetectionResult() { } + public Azure.AI.Language.Text.LanguageDetectionResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextLanguageDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextLanguageDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class AnalyzeTextOperationAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextOperationAction() { } + public string Name { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class AnalyzeTextOperationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextOperationResult(System.DateTimeOffset lastUpdateDateTime, Azure.AI.Language.Text.TextActionState status) { } + public System.DateTimeOffset LastUpdateDateTime { get { throw null; } } + public string Name { get { throw null; } } + public Azure.AI.Language.Text.TextActionState Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextOperationState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextOperationState() { } + public Azure.AI.Language.Text.TextActions Actions { get { throw null; } } + public System.DateTimeOffset CreatedAt { get { throw null; } } + public string DisplayName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.DateTimeOffset? ExpiresOn { get { throw null; } } + public System.Guid JobId { get { throw null; } } + public System.DateTimeOffset LastUpdatedAt { get { throw null; } } + public string NextLink { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + public Azure.AI.Language.Text.TextActionState Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextOperationState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextOperationState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextPiiResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextPiiResult() { } + public Azure.AI.Language.Text.PiiResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextPiiResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextPiiResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class AnalyzeTextResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextResult() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextSentimentResult : Azure.AI.Language.Text.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextSentimentResult() { } + public Azure.AI.Language.Text.SentimentResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextSentimentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AnalyzeTextSentimentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AreaMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AreaMetadata() { } + public Azure.AI.Language.Text.AreaUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AreaMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.AreaMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AreaUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AreaUnit(string value) { throw null; } + public static Azure.AI.Language.Text.AreaUnit Acre { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareCentimeter { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareDecameter { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareDecimeter { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareFoot { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareHectometer { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareInch { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareKilometer { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareMeter { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareMile { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareMillimeter { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit SquareYard { get { throw null; } } + public static Azure.AI.Language.Text.AreaUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.AreaUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.AreaUnit left, Azure.AI.Language.Text.AreaUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.AreaUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.AreaUnit left, Azure.AI.Language.Text.AreaUnit right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class BaseMetadata : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected BaseMetadata() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.BaseMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.BaseMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ClassificationActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ClassificationActionResult() { } + public System.Collections.Generic.IReadOnlyList Class { get { throw null; } } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ClassificationActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ClassificationActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ClassificationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ClassificationResult() { } + public string Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ClassificationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ClassificationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ClassificationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ClassificationType(string value) { throw null; } + public static Azure.AI.Language.Text.ClassificationType Multi { get { throw null; } } + public static Azure.AI.Language.Text.ClassificationType Single { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.ClassificationType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.ClassificationType left, Azure.AI.Language.Text.ClassificationType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.ClassificationType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.ClassificationType left, Azure.AI.Language.Text.ClassificationType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CurrencyMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CurrencyMetadata() { } + public string Iso4217 { get { throw null; } } + public string Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CurrencyMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CurrencyMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomAbstractiveSummarizationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public int? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + public Azure.AI.Language.Text.SummaryLengthBucket? SummaryLength { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomAbstractiveSummarizationOperationAction(Azure.AI.Language.Text.CustomAbstractiveSummarizationActionContent actionContent) { } + public Azure.AI.Language.Text.CustomAbstractiveSummarizationActionContent ActionContent { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomAbstractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.CustomAbstractiveSummarizationResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomAbstractiveSummarizationResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomAbstractiveSummarizationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntitiesActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomEntitiesActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntitiesActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntitiesActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntitiesActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomEntitiesActionResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntitiesActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntitiesActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntitiesOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomEntitiesOperationAction() { } + public Azure.AI.Language.Text.CustomEntitiesActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntitiesOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntitiesOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntityRecognitionOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomEntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.CustomEntitiesActionResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntityRecognitionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomEntityRecognitionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomHealthcareActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Relations { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareEntity() { } + public Azure.AI.Language.Text.HealthcareAssertion Assertion { get { throw null; } } + public Azure.AI.Language.Text.HealthcareEntityCategory Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public System.Collections.Generic.IReadOnlyList EntityComponentInformation { get { throw null; } } + public int Length { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } + public string Name { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomHealthcareOperationAction() { } + public Azure.AI.Language.Text.CustomHealthcareActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.CustomHealthcareResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomHealthcareResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomLabelClassificationActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomLabelClassificationActionResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomLabelClassificationActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomLabelClassificationActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomMultiLabelClassificationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomMultiLabelClassificationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomMultiLabelClassificationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomMultiLabelClassificationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomMultiLabelClassificationOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomMultiLabelClassificationOperationAction() { } + public Azure.AI.Language.Text.CustomMultiLabelClassificationActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomMultiLabelClassificationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomMultiLabelClassificationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomMultiLabelClassificationOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomMultiLabelClassificationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.CustomLabelClassificationActionResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomMultiLabelClassificationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomMultiLabelClassificationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentenceSentiment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentenceSentiment() { } + public Azure.AI.Language.Text.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public Azure.AI.Language.Text.SentenceSentimentValue Sentiment { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentenceSentiment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentenceSentiment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSentimentAnalysisActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSentimentAnalysisOperationAction() { } + public Azure.AI.Language.Text.CustomSentimentAnalysisActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentimentAnalysisOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.CustomSentimentAnalysisResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentimentAnalysisResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisResultDocument : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentimentAnalysisResultDocument() { } + public Azure.AI.Language.Text.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sentences { get { throw null; } } + public Azure.AI.Language.Text.DocumentSentiment Sentiment { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisResultDocument System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSentimentAnalysisResultDocument System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSingleLabelClassificationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSingleLabelClassificationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSingleLabelClassificationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSingleLabelClassificationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSingleLabelClassificationOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSingleLabelClassificationOperationAction() { } + public Azure.AI.Language.Text.CustomSingleLabelClassificationActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSingleLabelClassificationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSingleLabelClassificationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSingleLabelClassificationOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSingleLabelClassificationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.CustomLabelClassificationActionResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSingleLabelClassificationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.CustomSingleLabelClassificationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DateMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DateMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DateMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DateMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DateTimeMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DateTimeMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DateTimeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DateTimeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DateValue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DateValue() { } + public Azure.AI.Language.Text.TemporalModifier? Modifier { get { throw null; } } + public string Timex { get { throw null; } } + public string Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DateValue System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DateValue System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectedLanguage() { } + public double ConfidenceScore { get { throw null; } } + public string Iso6391Name { get { throw null; } } + public string Name { get { throw null; } } + public Azure.AI.Language.Text.ScriptKind? Script { get { throw null; } } + public Azure.AI.Language.Text.ScriptCode? ScriptCode { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DocumentError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentError() { } + public Azure.AI.Language.Text.AnalyzeTextError Error { get { throw null; } } + public string Id { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DocumentError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DocumentError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum DocumentSentiment + { + Positive = 0, + Neutral = 1, + Negative = 2, + Mixed = 3, + } + public partial class DocumentStatistics : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentStatistics() { } + public int CharactersCount { get { throw null; } } + public int TransactionsCount { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DocumentStatistics System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DocumentStatistics System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DocumentWarning : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentWarning() { } + public Azure.AI.Language.Text.WarningCode Code { get { throw null; } } + public string Message { get { throw null; } } + public string TargetRef { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DocumentWarning System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DocumentWarning System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DynamicClassificationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DynamicClassificationActionContent(System.Collections.Generic.IEnumerable categories) { } + public System.Collections.Generic.IList Categories { get { throw null; } } + public Azure.AI.Language.Text.ClassificationType? ClassificationType { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DynamicClassificationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DynamicClassificationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DynamicClassificationDocumentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DynamicClassificationDocumentResult() { } + public System.Collections.Generic.IReadOnlyList Classifications { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DynamicClassificationDocumentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DynamicClassificationDocumentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DynamicClassificationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DynamicClassificationResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DynamicClassificationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.DynamicClassificationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntitiesActionContent() { } + public System.Collections.Generic.IList Exclusions { get { throw null; } } + public System.Collections.Generic.IList Inclusions { get { throw null; } } + public Azure.AI.Language.Text.EntityInferenceConfig InferenceOptions { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public Azure.AI.Language.Text.EntityOverlapPolicy OverlapPolicy { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesDocumentResultWithMetadataDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntitiesDocumentResultWithMetadataDetectedLanguage() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesDocumentResultWithMetadataDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesDocumentResultWithMetadataDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntitiesOperationAction() { } + public Azure.AI.Language.Text.EntitiesActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntitiesResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntitiesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EntityCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EntityCategory(string value) { throw null; } + public static Azure.AI.Language.Text.EntityCategory Address { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Age { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Airport { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Area { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory City { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory ComputingProduct { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Continent { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory CountryRegion { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory CulturalEvent { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Currency { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Date { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory DateRange { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory DateTime { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory DateTimeRange { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Dimension { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Duration { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Email { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Event { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Geological { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory GeoPoliticalEntity { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Height { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Information { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory IpAddress { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Length { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Location { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory NaturalEvent { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Number { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory NumberRange { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Numeric { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Ordinal { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Organization { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory OrganizationMedical { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory OrganizationSports { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory OrganizationStockExchange { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Percentage { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Person { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory PersonType { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Product { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory SetTemporal { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Skill { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Speed { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory SportsEvent { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory State { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Structural { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Temperature { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Temporal { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Time { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory TimeRange { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Uri { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Volume { get { throw null; } } + public static Azure.AI.Language.Text.EntityCategory Weight { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.EntityCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.EntityCategory left, Azure.AI.Language.Text.EntityCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Text.EntityCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.EntityCategory left, Azure.AI.Language.Text.EntityCategory right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class EntityComponentInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected EntityComponentInformation() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityComponentInformation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityComponentInformation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityInferenceConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityInferenceConfig() { } + public bool? ExcludeNormalizedValues { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityInferenceConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityInferenceConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityLinkingActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingMatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingMatch() { } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingMatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingMatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityLinkingOperationAction() { } + public Azure.AI.Language.Text.EntityLinkingActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.EntityLinkingResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityLinkingResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class EntityOverlapPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected EntityOverlapPolicy() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityOverlapPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityOverlapPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityRecognitionOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.EntitiesResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityRecognitionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityRecognitionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityTag : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityTag() { } + public double? ConfidenceScore { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityTag System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.EntityTag System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractedSummaryActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractedSummaryActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sentences { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractedSummaryActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractedSummaryActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractedSummarySentence : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractedSummarySentence() { } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public double RankScore { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractedSummarySentence System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractedSummarySentence System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExtractiveSummarizationActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public long? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria? SortBy { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExtractiveSummarizationOperationAction() { } + public Azure.AI.Language.Text.ExtractiveSummarizationActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.ExtractiveSummarizationResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractiveSummarizationResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ExtractiveSummarizationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExtractiveSummarizationSortingCriteria : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExtractiveSummarizationSortingCriteria(string value) { throw null; } + public static Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria Offset { get { throw null; } } + public static Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria Rank { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria right) { throw null; } + public static implicit operator Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Text.ExtractiveSummarizationSortingCriteria right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FhirBundle : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FhirBundle() { } + public System.Collections.Generic.IReadOnlyDictionary AdditionalProperties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.FhirBundle System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.FhirBundle System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FhirVersion : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FhirVersion(string value) { throw null; } + public static Azure.AI.Language.Text.FhirVersion _401 { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.FhirVersion other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.FhirVersion left, Azure.AI.Language.Text.FhirVersion right) { throw null; } + public static implicit operator Azure.AI.Language.Text.FhirVersion (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.FhirVersion left, Azure.AI.Language.Text.FhirVersion right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HealthcareActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public HealthcareActionContent() { } + public Azure.AI.Language.Text.HealthcareDocumentType? DocumentType { get { throw null; } set { } } + public Azure.AI.Language.Text.FhirVersion? FhirVersion { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public Azure.AI.Language.Text.FhirBundle FhirBundle { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Relations { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareAssertion : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareAssertion() { } + public Azure.AI.Language.Text.HealthcareAssertionAssociation? Association { get { throw null; } } + public Azure.AI.Language.Text.HealthcareAssertionCertainty? Certainty { get { throw null; } } + public Azure.AI.Language.Text.HealthcareAssertionConditionality? Conditionality { get { throw null; } } + public Azure.AI.Language.Text.HealthcareAssertionTemporality? Temporality { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareAssertion System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareAssertion System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum HealthcareAssertionAssociation + { + Subject = 0, + Other = 1, + } + public enum HealthcareAssertionCertainty + { + Positive = 0, + PositivePossible = 1, + NeutralPossible = 2, + NegativePossible = 3, + Negative = 4, + } + public enum HealthcareAssertionConditionality + { + Hypothetical = 0, + Conditional = 1, + } + public enum HealthcareAssertionTemporality + { + Current = 0, + Past = 1, + Future = 2, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HealthcareDocumentType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HealthcareDocumentType(string value) { throw null; } + public static Azure.AI.Language.Text.HealthcareDocumentType ClinicalTrial { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType Consult { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType DischargeSummary { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType HistoryAndPhysical { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType Imaging { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType None { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType Pathology { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType ProcedureNote { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareDocumentType ProgressNote { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.HealthcareDocumentType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.HealthcareDocumentType left, Azure.AI.Language.Text.HealthcareDocumentType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.HealthcareDocumentType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.HealthcareDocumentType left, Azure.AI.Language.Text.HealthcareDocumentType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HealthcareEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareEntity() { } + public Azure.AI.Language.Text.HealthcareAssertion Assertion { get { throw null; } } + public Azure.AI.Language.Text.HealthcareEntityCategory Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } + public string Name { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HealthcareEntityCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HealthcareEntityCategory(string value) { throw null; } + public static Azure.AI.Language.Text.HealthcareEntityCategory AdministrativeEvent { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Age { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Allergen { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory BodyStructure { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory CareEnvironment { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory ConditionQualifier { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory ConditionScale { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Course { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Date { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Diagnosis { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Direction { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Dosage { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Employment { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Ethnicity { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory ExaminationName { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Expression { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory FamilyRelation { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Frequency { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Gender { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory GeneOrProtein { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory HealthcareProfession { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory LivingStatus { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MeasurementUnit { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MeasurementValue { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MedicationClass { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MedicationForm { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MedicationName { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MedicationRoute { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory MutationType { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory RelationalOperator { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory SubstanceUse { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory SubstanceUseAmount { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory SymptomOrSign { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Time { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory TreatmentName { get { throw null; } } + public static Azure.AI.Language.Text.HealthcareEntityCategory Variant { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.HealthcareEntityCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.HealthcareEntityCategory left, Azure.AI.Language.Text.HealthcareEntityCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Text.HealthcareEntityCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.HealthcareEntityCategory left, Azure.AI.Language.Text.HealthcareEntityCategory right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HealthcareEntityLink : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareEntityLink() { } + public string DataSource { get { throw null; } } + public string Id { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareEntityLink System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareEntityLink System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public HealthcareOperationAction() { } + public Azure.AI.Language.Text.HealthcareActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.HealthcareResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareRelation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareRelation() { } + public double? ConfidenceScore { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public Azure.AI.Language.Text.RelationType RelationType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareRelation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareRelation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareRelationEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareRelationEntity() { } + public string Ref { get { throw null; } } + public string Role { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareRelationEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareRelationEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.HealthcareResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InformationMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal InformationMetadata() { } + public Azure.AI.Language.Text.InformationUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.InformationMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.InformationMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct InformationUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public InformationUnit(string value) { throw null; } + public static Azure.AI.Language.Text.InformationUnit Bit { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Byte { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Gigabit { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Gigabyte { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Kilobit { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Kilobyte { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Megabit { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Megabyte { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Petabit { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Petabyte { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Terabit { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Terabyte { get { throw null; } } + public static Azure.AI.Language.Text.InformationUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.InformationUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.InformationUnit left, Azure.AI.Language.Text.InformationUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.InformationUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.InformationUnit left, Azure.AI.Language.Text.InformationUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct InnerErrorCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public InnerErrorCode(string value) { throw null; } + public static Azure.AI.Language.Text.InnerErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode EmptyRequest { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode ExtractionFailure { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode InvalidCountryHint { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode InvalidDocument { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode InvalidDocumentBatch { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode InvalidParameterValue { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode InvalidRequestBodyFormat { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode KnowledgeBaseNotFound { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode MissingInputDocuments { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode ModelVersionIncorrect { get { throw null; } } + public static Azure.AI.Language.Text.InnerErrorCode UnsupportedLanguageCode { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.InnerErrorCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.InnerErrorCode left, Azure.AI.Language.Text.InnerErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.InnerErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.InnerErrorCode left, Azure.AI.Language.Text.InnerErrorCode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class InnerErrorModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal InnerErrorModel() { } + public Azure.AI.Language.Text.InnerErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Details { get { throw null; } } + public Azure.AI.Language.Text.InnerErrorModel Innererror { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.InnerErrorModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.InnerErrorModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyPhraseActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseExtractionOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal KeyPhraseExtractionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.KeyPhraseResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseExtractionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseExtractionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyPhraseOperationAction() { } + public Azure.AI.Language.Text.KeyPhraseActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal KeyPhraseResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhraseResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhrasesActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal KeyPhrasesActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList KeyPhrases { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhrasesActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.KeyPhrasesActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public LanguageDetectionActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionDocumentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LanguageDetectionDocumentResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionDocumentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionDocumentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LanguageDetectionResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionTextInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public LanguageDetectionTextInput() { } + public System.Collections.Generic.IList LanguageInputs { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionTextInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageDetectionTextInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public LanguageInput(string id, string text) { } + public string CountryHint { get { throw null; } set { } } + public string Id { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LanguageInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LearnedComponent : Azure.AI.Language.Text.EntityComponentInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LearnedComponent() { } + public string Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LearnedComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LearnedComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LengthMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LengthMetadata() { } + public Azure.AI.Language.Text.LengthUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LengthMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LengthMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LengthUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LengthUnit(string value) { throw null; } + public static Azure.AI.Language.Text.LengthUnit Centimeter { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Decameter { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Decimeter { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Foot { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Hectometer { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Inch { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Kilometer { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit LightYear { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Meter { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Micrometer { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Mile { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Millimeter { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Nanometer { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Picometer { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Point { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Unspecified { get { throw null; } } + public static Azure.AI.Language.Text.LengthUnit Yard { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.LengthUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.LengthUnit left, Azure.AI.Language.Text.LengthUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.LengthUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.LengthUnit left, Azure.AI.Language.Text.LengthUnit right) { throw null; } + public override string ToString() { throw null; } + } + public partial class LinkedEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LinkedEntity() { } + public string BingId { get { throw null; } } + public string DataSource { get { throw null; } } + public string Id { get { throw null; } } + public string Language { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Matches { get { throw null; } } + public string Name { get { throw null; } } + public string Url { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LinkedEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.LinkedEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ListComponent : Azure.AI.Language.Text.EntityComponentInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ListComponent() { } + public string Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ListComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.ListComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MatchLongestEntityPolicyType : Azure.AI.Language.Text.EntityOverlapPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MatchLongestEntityPolicyType() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.MatchLongestEntityPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.MatchLongestEntityPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MultiLanguageInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MultiLanguageInput(string id, string text) { } + public string Id { get { throw null; } } + public string Language { get { throw null; } set { } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.MultiLanguageInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.MultiLanguageInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MultiLanguageTextInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MultiLanguageTextInput() { } + public System.Collections.Generic.IList MultiLanguageInputs { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.MultiLanguageTextInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.MultiLanguageTextInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NamedEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NamedEntity() { } + public string Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NamedEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NamedEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NamedEntityWithMetadata : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NamedEntityWithMetadata() { } + public string Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public Azure.AI.Language.Text.BaseMetadata Metadata { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Tags { get { throw null; } } + public string Text { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NamedEntityWithMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NamedEntityWithMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NumberKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NumberKind(string value) { throw null; } + public static Azure.AI.Language.Text.NumberKind Decimal { get { throw null; } } + public static Azure.AI.Language.Text.NumberKind Fraction { get { throw null; } } + public static Azure.AI.Language.Text.NumberKind Integer { get { throw null; } } + public static Azure.AI.Language.Text.NumberKind Percent { get { throw null; } } + public static Azure.AI.Language.Text.NumberKind Power { get { throw null; } } + public static Azure.AI.Language.Text.NumberKind Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.NumberKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.NumberKind left, Azure.AI.Language.Text.NumberKind right) { throw null; } + public static implicit operator Azure.AI.Language.Text.NumberKind (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.NumberKind left, Azure.AI.Language.Text.NumberKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NumberMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NumberMetadata() { } + public Azure.AI.Language.Text.NumberKind NumberKind { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NumberMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NumberMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NumericRangeMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NumericRangeMetadata() { } + public double Maximum { get { throw null; } } + public double Minimum { get { throw null; } } + public Azure.AI.Language.Text.RangeInclusivity? RangeInclusivity { get { throw null; } } + public Azure.AI.Language.Text.RangeKind RangeKind { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NumericRangeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.NumericRangeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OrdinalMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OrdinalMetadata() { } + public string Offset { get { throw null; } } + public Azure.AI.Language.Text.RelativeTo RelativeTo { get { throw null; } } + public string Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.OrdinalMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.OrdinalMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiActionContent() { } + public Azure.AI.Language.Text.PiiDomain? Domain { get { throw null; } set { } } + public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public System.Collections.Generic.IList PiiCategories { get { throw null; } } + public Azure.AI.Language.Text.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiActionResult() { } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public string RedactedText { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PiiCategoriesExclude : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PiiCategoriesExclude(string value) { throw null; } + public static Azure.AI.Language.Text.PiiCategoriesExclude AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude Address { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude Age { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureSas { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude Date { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude Email { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EsDni { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FiNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude IlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude IPAddress { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude Organization { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude Person { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SaNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SeNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude SwiftCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude TwNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude URL { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategoriesExclude ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.PiiCategoriesExclude other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.PiiCategoriesExclude left, Azure.AI.Language.Text.PiiCategoriesExclude right) { throw null; } + public static implicit operator Azure.AI.Language.Text.PiiCategoriesExclude (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.PiiCategoriesExclude left, Azure.AI.Language.Text.PiiCategoriesExclude right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PiiCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PiiCategory(string value) { throw null; } + public static Azure.AI.Language.Text.PiiCategory AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Address { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Age { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory All { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureSas { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Date { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Default { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Email { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EsDni { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FiNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory IlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory IPAddress { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Organization { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory Person { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SaNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SeNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory SwiftCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory TwNationalId { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory URL { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.PiiCategory ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.PiiCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.PiiCategory left, Azure.AI.Language.Text.PiiCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Text.PiiCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.PiiCategory left, Azure.AI.Language.Text.PiiCategory right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PiiDomain : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PiiDomain(string value) { throw null; } + public static Azure.AI.Language.Text.PiiDomain None { get { throw null; } } + public static Azure.AI.Language.Text.PiiDomain Phi { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.PiiDomain other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.PiiDomain left, Azure.AI.Language.Text.PiiDomain right) { throw null; } + public static implicit operator Azure.AI.Language.Text.PiiDomain (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.PiiDomain left, Azure.AI.Language.Text.PiiDomain right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PiiEntityRecognitionOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiEntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.PiiResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiEntityRecognitionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiEntityRecognitionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiOperationAction() { } + public Azure.AI.Language.Text.PiiActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PiiResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PrebuiltComponent : Azure.AI.Language.Text.EntityComponentInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PrebuiltComponent() { } + public string Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PrebuiltComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.PrebuiltComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RangeInclusivity : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RangeInclusivity(string value) { throw null; } + public static Azure.AI.Language.Text.RangeInclusivity LeftInclusive { get { throw null; } } + public static Azure.AI.Language.Text.RangeInclusivity LeftRightInclusive { get { throw null; } } + public static Azure.AI.Language.Text.RangeInclusivity NoneInclusive { get { throw null; } } + public static Azure.AI.Language.Text.RangeInclusivity RightInclusive { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.RangeInclusivity other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.RangeInclusivity left, Azure.AI.Language.Text.RangeInclusivity right) { throw null; } + public static implicit operator Azure.AI.Language.Text.RangeInclusivity (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.RangeInclusivity left, Azure.AI.Language.Text.RangeInclusivity right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RangeKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RangeKind(string value) { throw null; } + public static Azure.AI.Language.Text.RangeKind Age { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Area { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Currency { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Information { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Length { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Number { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Speed { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Temperature { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Volume { get { throw null; } } + public static Azure.AI.Language.Text.RangeKind Weight { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.RangeKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.RangeKind left, Azure.AI.Language.Text.RangeKind right) { throw null; } + public static implicit operator Azure.AI.Language.Text.RangeKind (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.RangeKind left, Azure.AI.Language.Text.RangeKind right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RedactionCharacter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedactionCharacter(string value) { throw null; } + public static Azure.AI.Language.Text.RedactionCharacter Ampersand { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Asterisk { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter AtSign { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Caret { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Dollar { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter EqualsValue { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter ExclamationPoint { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Minus { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter NumberSign { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter PerCent { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Plus { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter QuestionMark { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Tilde { get { throw null; } } + public static Azure.AI.Language.Text.RedactionCharacter Underscore { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.RedactionCharacter other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.RedactionCharacter left, Azure.AI.Language.Text.RedactionCharacter right) { throw null; } + public static implicit operator Azure.AI.Language.Text.RedactionCharacter (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.RedactionCharacter left, Azure.AI.Language.Text.RedactionCharacter right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RelationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RelationType(string value) { throw null; } + public static Azure.AI.Language.Text.RelationType Abbreviation { get { throw null; } } + public static Azure.AI.Language.Text.RelationType BodySiteOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType BodySiteOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.RelationType CourseOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType CourseOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.RelationType CourseOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.RelationType CourseOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.RelationType DirectionOfBodyStructure { get { throw null; } } + public static Azure.AI.Language.Text.RelationType DirectionOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType DirectionOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.RelationType DirectionOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.RelationType DosageOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.RelationType ExaminationFindsCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType ExpressionOfGene { get { throw null; } } + public static Azure.AI.Language.Text.RelationType ExpressionOfVariant { get { throw null; } } + public static Azure.AI.Language.Text.RelationType FormOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.RelationType FrequencyOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType FrequencyOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.RelationType FrequencyOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.RelationType MutationTypeOfGene { get { throw null; } } + public static Azure.AI.Language.Text.RelationType MutationTypeOfVariant { get { throw null; } } + public static Azure.AI.Language.Text.RelationType QualifierOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType RelationOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.RelationType RouteOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.RelationType ScaleOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType TimeOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType TimeOfEvent { get { throw null; } } + public static Azure.AI.Language.Text.RelationType TimeOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.RelationType TimeOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.RelationType TimeOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.RelationType UnitOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType UnitOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.RelationType ValueOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.RelationType ValueOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.RelationType VariantOfGene { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.RelationType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.RelationType left, Azure.AI.Language.Text.RelationType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.RelationType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.RelationType left, Azure.AI.Language.Text.RelationType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RelativeTo : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RelativeTo(string value) { throw null; } + public static Azure.AI.Language.Text.RelativeTo Current { get { throw null; } } + public static Azure.AI.Language.Text.RelativeTo End { get { throw null; } } + public static Azure.AI.Language.Text.RelativeTo Start { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.RelativeTo other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.RelativeTo left, Azure.AI.Language.Text.RelativeTo right) { throw null; } + public static implicit operator Azure.AI.Language.Text.RelativeTo (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.RelativeTo left, Azure.AI.Language.Text.RelativeTo right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestStatistics : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RequestStatistics() { } + public int DocumentsCount { get { throw null; } } + public int ErroneousDocumentsCount { get { throw null; } } + public long TransactionsCount { get { throw null; } } + public int ValidDocumentsCount { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.RequestStatistics System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.RequestStatistics System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScriptCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScriptCode(string value) { throw null; } + public static Azure.AI.Language.Text.ScriptCode Arab { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Armn { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Beng { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Cans { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Cyrl { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Deva { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Ethi { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Geor { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Grek { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Gujr { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Guru { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Hang { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Hans { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Hant { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Hebr { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Jpan { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Khmr { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Knda { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Laoo { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Latn { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Mlym { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Mymr { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Orya { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Sinh { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Taml { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Telu { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Thaa { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Thai { get { throw null; } } + public static Azure.AI.Language.Text.ScriptCode Tibt { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.ScriptCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.ScriptCode left, Azure.AI.Language.Text.ScriptCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.ScriptCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.ScriptCode left, Azure.AI.Language.Text.ScriptCode right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScriptKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScriptKind(string value) { throw null; } + public static Azure.AI.Language.Text.ScriptKind Arabic { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Armenian { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Bangla { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Cyrillic { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Devanagari { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Ethiopic { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Georgian { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Greek { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Gujarati { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Gurmukhi { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Hangul { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind HanSimplified { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind HanTraditional { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Hebrew { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Japanese { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Kannada { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Khmer { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Lao { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Latin { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Malayalam { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Myanmar { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Odia { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Sinhala { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Tamil { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Telugu { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Thaana { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Thai { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind Tibetan { get { throw null; } } + public static Azure.AI.Language.Text.ScriptKind UnifiedCanadianAboriginalSyllabics { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.ScriptKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.ScriptKind left, Azure.AI.Language.Text.ScriptKind right) { throw null; } + public static implicit operator Azure.AI.Language.Text.ScriptKind (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.ScriptKind left, Azure.AI.Language.Text.ScriptKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SentenceAssessment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentenceAssessment() { } + public Azure.AI.Language.Text.TargetConfidenceScoreLabel ConfidenceScores { get { throw null; } } + public bool IsNegated { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public Azure.AI.Language.Text.TokenSentiment Sentiment { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentenceAssessment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentenceAssessment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentenceSentiment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentenceSentiment() { } + public System.Collections.Generic.IReadOnlyList Assessments { get { throw null; } } + public Azure.AI.Language.Text.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public Azure.AI.Language.Text.SentenceSentimentValue Sentiment { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Targets { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentenceSentiment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentenceSentiment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum SentenceSentimentValue + { + Positive = 0, + Neutral = 1, + Negative = 2, + } + public partial class SentenceTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentenceTarget() { } + public Azure.AI.Language.Text.TargetConfidenceScoreLabel ConfidenceScores { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Relations { get { throw null; } } + public Azure.AI.Language.Text.TokenSentiment Sentiment { get { throw null; } } + public string Text { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentenceTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentenceTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentActionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentActionResult() { } + public Azure.AI.Language.Text.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public Azure.AI.Language.Text.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sentences { get { throw null; } } + public Azure.AI.Language.Text.DocumentSentiment Sentiment { get { throw null; } } + public Azure.AI.Language.Text.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentActionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentActionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentAnalysisActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SentimentAnalysisActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public bool? OpinionMining { get { throw null; } set { } } + public Azure.AI.Language.Text.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentAnalysisActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentAnalysisActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentAnalysisOperationAction : Azure.AI.Language.Text.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SentimentAnalysisOperationAction() { } + public Azure.AI.Language.Text.SentimentAnalysisActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentAnalysisOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentAnalysisOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentConfidenceScores : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentConfidenceScores() { } + public double Negative { get { throw null; } } + public double Neutral { get { throw null; } } + public double Positive { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentConfidenceScores System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentConfidenceScores System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentOperationResult : Azure.AI.Language.Text.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.TextActionState)) { } + public Azure.AI.Language.Text.SentimentResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SentimentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SpeedMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SpeedMetadata() { } + public Azure.AI.Language.Text.SpeedUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SpeedMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SpeedMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SpeedUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SpeedUnit(string value) { throw null; } + public static Azure.AI.Language.Text.SpeedUnit CentimetersPerMillisecond { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit FeetPerMinute { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit FeetPerSecond { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit KilometersPerHour { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit KilometersPerMillisecond { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit KilometersPerMinute { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit KilometersPerSecond { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit Knots { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit MetersPerMillisecond { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit MetersPerSecond { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit MilesPerHour { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit Unspecified { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit YardsPerMinute { get { throw null; } } + public static Azure.AI.Language.Text.SpeedUnit YardsPerSecond { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.SpeedUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.SpeedUnit left, Azure.AI.Language.Text.SpeedUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.SpeedUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.SpeedUnit left, Azure.AI.Language.Text.SpeedUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StringIndexType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StringIndexType(string value) { throw null; } + public static Azure.AI.Language.Text.StringIndexType TextElementsV8 { get { throw null; } } + public static Azure.AI.Language.Text.StringIndexType UnicodeCodePoint { get { throw null; } } + public static Azure.AI.Language.Text.StringIndexType Utf16CodeUnit { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.StringIndexType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.StringIndexType left, Azure.AI.Language.Text.StringIndexType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.StringIndexType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.StringIndexType left, Azure.AI.Language.Text.StringIndexType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SummaryContext : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SummaryContext() { } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SummaryContext System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.SummaryContext System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SummaryLengthBucket : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SummaryLengthBucket(string value) { throw null; } + public static Azure.AI.Language.Text.SummaryLengthBucket Long { get { throw null; } } + public static Azure.AI.Language.Text.SummaryLengthBucket Medium { get { throw null; } } + public static Azure.AI.Language.Text.SummaryLengthBucket Short { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.SummaryLengthBucket other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.SummaryLengthBucket left, Azure.AI.Language.Text.SummaryLengthBucket right) { throw null; } + public static implicit operator Azure.AI.Language.Text.SummaryLengthBucket (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.SummaryLengthBucket left, Azure.AI.Language.Text.SummaryLengthBucket right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TargetConfidenceScoreLabel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TargetConfidenceScoreLabel() { } + public double Negative { get { throw null; } } + public double Positive { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TargetConfidenceScoreLabel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TargetConfidenceScoreLabel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TargetRelation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TargetRelation() { } + public string Ref { get { throw null; } } + public Azure.AI.Language.Text.TargetRelationType RelationType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TargetRelation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TargetRelation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum TargetRelationType + { + Assessment = 0, + Target = 1, + } + public partial class TemperatureMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemperatureMetadata() { } + public Azure.AI.Language.Text.TemperatureUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemperatureMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemperatureMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TemperatureUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TemperatureUnit(string value) { throw null; } + public static Azure.AI.Language.Text.TemperatureUnit Celsius { get { throw null; } } + public static Azure.AI.Language.Text.TemperatureUnit Fahrenheit { get { throw null; } } + public static Azure.AI.Language.Text.TemperatureUnit Kelvin { get { throw null; } } + public static Azure.AI.Language.Text.TemperatureUnit Rankine { get { throw null; } } + public static Azure.AI.Language.Text.TemperatureUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.TemperatureUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.TemperatureUnit left, Azure.AI.Language.Text.TemperatureUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.TemperatureUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.TemperatureUnit left, Azure.AI.Language.Text.TemperatureUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TemporalModifier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TemporalModifier(string value) { throw null; } + public static Azure.AI.Language.Text.TemporalModifier After { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier AfterApprox { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier AfterMid { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier AfterStart { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Approx { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Before { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier BeforeApprox { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier BeforeEnd { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier BeforeStart { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier End { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Less { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Mid { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier More { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier ReferenceUndefined { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Since { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier SinceEnd { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Start { get { throw null; } } + public static Azure.AI.Language.Text.TemporalModifier Until { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.TemporalModifier other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.TemporalModifier left, Azure.AI.Language.Text.TemporalModifier right) { throw null; } + public static implicit operator Azure.AI.Language.Text.TemporalModifier (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.TemporalModifier left, Azure.AI.Language.Text.TemporalModifier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TemporalSetMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemporalSetMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemporalSetMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemporalSetMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TemporalSpanMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemporalSpanMetadata() { } + public System.Collections.Generic.IReadOnlyList SpanValues { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemporalSpanMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemporalSpanMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TemporalSpanValues : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemporalSpanValues() { } + public string Begin { get { throw null; } } + public string Duration { get { throw null; } } + public string End { get { throw null; } } + public Azure.AI.Language.Text.TemporalModifier? Modifier { get { throw null; } } + public string Timex { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemporalSpanValues System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TemporalSpanValues System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextActions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TextActions() { } + public int Completed { get { throw null; } } + public int Failed { get { throw null; } } + public int InProgress { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Items { get { throw null; } } + public int Total { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextActions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextActions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TextActionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TextActionState(string value) { throw null; } + public static Azure.AI.Language.Text.TextActionState Cancelled { get { throw null; } } + public static Azure.AI.Language.Text.TextActionState Cancelling { get { throw null; } } + public static Azure.AI.Language.Text.TextActionState Failed { get { throw null; } } + public static Azure.AI.Language.Text.TextActionState NotStarted { get { throw null; } } + public static Azure.AI.Language.Text.TextActionState PartiallyCompleted { get { throw null; } } + public static Azure.AI.Language.Text.TextActionState Running { get { throw null; } } + public static Azure.AI.Language.Text.TextActionState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.TextActionState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.TextActionState left, Azure.AI.Language.Text.TextActionState right) { throw null; } + public static implicit operator Azure.AI.Language.Text.TextActionState (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.TextActionState left, Azure.AI.Language.Text.TextActionState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TextAnalysisClient + { + protected TextAnalysisClient() { } + public TextAnalysisClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public TextAnalysisClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Language.Text.TextAnalysisClientOptions options) { } + public TextAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public TextAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Language.Text.TextAnalysisClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response AnalyzeText(Azure.AI.Language.Text.AnalyzeTextInput analyzeTextInput, bool? showStatistics = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response AnalyzeText(Azure.Core.RequestContent content, bool? showStatistics = default(bool?), Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> AnalyzeTextAsync(Azure.AI.Language.Text.AnalyzeTextInput analyzeTextInput, bool? showStatistics = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextAsync(Azure.Core.RequestContent content, bool? showStatistics = default(bool?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation AnalyzeTextCancelOperation(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextCancelOperationAsync(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response AnalyzeTextOperationStatus(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual Azure.Response AnalyzeTextOperationStatus(System.Guid jobId, bool? showStats = default(bool?), int? top = default(int?), int? skip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextOperationStatusAsync(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> AnalyzeTextOperationStatusAsync(System.Guid jobId, bool? showStats = default(bool?), int? top = default(int?), int? skip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation AnalyzeTextSubmitOperation(Azure.WaitUntil waitUntil, Azure.AI.Language.Text.MultiLanguageTextInput textInput, System.Collections.Generic.IEnumerable actions, string displayName = null, string defaultLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation AnalyzeTextSubmitOperation(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.AI.Language.Text.MultiLanguageTextInput textInput, System.Collections.Generic.IEnumerable actions, string displayName = null, string defaultLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class TextAnalysisClientOptions : Azure.Core.ClientOptions + { + public TextAnalysisClientOptions(Azure.AI.Language.Text.TextAnalysisClientOptions.ServiceVersion version = Azure.AI.Language.Text.TextAnalysisClientOptions.ServiceVersion.V2023_11_15_Preview) { } + public enum ServiceVersion + { + V2022_05_01 = 1, + V2023_04_01 = 2, + V2023_11_15_Preview = 3, + } + } + public partial class TextDynamicClassificationInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextDynamicClassificationInput() { } + public Azure.AI.Language.Text.DynamicClassificationActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.MultiLanguageTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextDynamicClassificationInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextDynamicClassificationInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextEntityLinkingInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextEntityLinkingInput() { } + public Azure.AI.Language.Text.EntityLinkingActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.MultiLanguageTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextEntityLinkingInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextEntityLinkingInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextEntityRecognitionInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextEntityRecognitionInput() { } + public Azure.AI.Language.Text.EntitiesActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.MultiLanguageTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextEntityRecognitionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextEntityRecognitionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextKeyPhraseExtractionInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextKeyPhraseExtractionInput() { } + public Azure.AI.Language.Text.KeyPhraseActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.MultiLanguageTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextKeyPhraseExtractionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextKeyPhraseExtractionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextLanguageDetectionInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextLanguageDetectionInput() { } + public Azure.AI.Language.Text.LanguageDetectionActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.LanguageDetectionTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextLanguageDetectionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextLanguageDetectionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextPiiEntitiesRecognitionInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextPiiEntitiesRecognitionInput() { } + public Azure.AI.Language.Text.PiiActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.MultiLanguageTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextPiiEntitiesRecognitionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextPiiEntitiesRecognitionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextSentimentAnalysisInput : Azure.AI.Language.Text.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextSentimentAnalysisInput() { } + public Azure.AI.Language.Text.SentimentAnalysisActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.MultiLanguageTextInput TextInput { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextSentimentAnalysisInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TextSentimentAnalysisInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TimeMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TimeMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TimeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.TimeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum TokenSentiment + { + Positive = 0, + Mixed = 1, + Negative = 2, + } + public partial class VolumeMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal VolumeMetadata() { } + public Azure.AI.Language.Text.VolumeUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.VolumeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.VolumeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct VolumeUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public VolumeUnit(string value) { throw null; } + public static Azure.AI.Language.Text.VolumeUnit Barrel { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Bushel { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Centiliter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Cord { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicCentimeter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicFoot { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicInch { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicMeter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicMile { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicMillimeter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit CubicYard { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Cup { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Decaliter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit FluidDram { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit FluidOunce { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Gill { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Hectoliter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Hogshead { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Liter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Milliliter { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Minim { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Peck { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Pinch { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Pint { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Quart { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Tablespoon { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Teaspoon { get { throw null; } } + public static Azure.AI.Language.Text.VolumeUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.VolumeUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.VolumeUnit left, Azure.AI.Language.Text.VolumeUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.VolumeUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.VolumeUnit left, Azure.AI.Language.Text.VolumeUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct WarningCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WarningCode(string value) { throw null; } + public static Azure.AI.Language.Text.WarningCode DocumentTruncated { get { throw null; } } + public static Azure.AI.Language.Text.WarningCode LongWordsInDocument { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.WarningCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.WarningCode left, Azure.AI.Language.Text.WarningCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.WarningCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.WarningCode left, Azure.AI.Language.Text.WarningCode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class WeightMetadata : Azure.AI.Language.Text.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WeightMetadata() { } + public Azure.AI.Language.Text.WeightUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.WeightMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.WeightMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct WeightUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WeightUnit(string value) { throw null; } + public static Azure.AI.Language.Text.WeightUnit Dram { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Gallon { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Grain { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Gram { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Kilogram { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit LongTonBritish { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit MetricTon { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Milligram { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Ounce { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit PennyWeight { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Pound { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit ShortHundredWeightUs { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit ShortTonUs { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Stone { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Ton { get { throw null; } } + public static Azure.AI.Language.Text.WeightUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.WeightUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.WeightUnit left, Azure.AI.Language.Text.WeightUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.WeightUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.WeightUnit left, Azure.AI.Language.Text.WeightUnit right) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class AILanguageTextClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj new file mode 100644 index 000000000000..15530be69ce0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj @@ -0,0 +1,20 @@ + + + This is the Azure.AI.Language.Text client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.AI.Language.Text for Azure Data Plane + 1.0.0-beta.1 + Azure.AI.Language.Text + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs new file mode 100644 index 000000000000..9bae8b4e15b0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.AI.Language.Text; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AILanguageTextClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + public static IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new TextAnalysisClient(endpoint, credential, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + public static IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new TextAnalysisClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs new file mode 100644 index 000000000000..3d51923a16a2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs @@ -0,0 +1,1700 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Model factory for models. + public static partial class AILanguageTextModelFactory + { + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default. (Following only applies to 2023-04-15-preview and above) For Auto Language Detection, use \"auto\". If not set, use \"en\" for English as default. + /// A new instance for mocking. + public static MultiLanguageInput MultiLanguageInput(string id = null, string text = null, string language = null) + { + return new MultiLanguageInput(id, text, language, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// The country hint to help with language detection of the text. + /// A new instance for mocking. + public static LanguageInput LanguageInput(string id = null, string text = null, string countryHint = null) + { + return new LanguageInput(id, text, countryHint, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Results for Dynamic Classification task. + /// A new instance for mocking. + public static AnalyzeTextDynamicClassificationResult AnalyzeTextDynamicClassificationResult(DynamicClassificationResult results = null) + { + return new AnalyzeTextDynamicClassificationResult(AnalyzeTextResultsKind.DynamicClassificationResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static DynamicClassificationResult DynamicClassificationResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new DynamicClassificationResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// A new instance for mocking. + public static DocumentError DocumentError(string id = null, AnalyzeTextError error = null) + { + return new DocumentError(id, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// A human-readable representation of the error. + /// The target of the error. + /// An array of details about specific errors that led to this reported error. + /// An object containing more specific information than the current object about the error. + /// A new instance for mocking. + public static AnalyzeTextError AnalyzeTextError(AnalyzeTextErrorCode code = default, string message = null, string target = null, IEnumerable details = null, InnerErrorModel innererror = null) + { + details ??= new List(); + + return new AnalyzeTextError( + code, + message, + target, + details?.ToList(), + innererror, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// Error message. + /// Error details. + /// Error target. + /// An object containing more specific information than the current object about the error. + /// A new instance for mocking. + public static InnerErrorModel InnerErrorModel(InnerErrorCode code = default, string message = null, IReadOnlyDictionary details = null, string target = null, InnerErrorModel innererror = null) + { + details ??= new Dictionary(); + + return new InnerErrorModel( + code, + message, + details, + target, + innererror, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of documents submitted in the request. + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + /// Number of transactions for the request. + /// A new instance for mocking. + public static RequestStatistics RequestStatistics(int documentsCount = default, int validDocumentsCount = default, int erroneousDocumentsCount = default, long transactionsCount = default) + { + return new RequestStatistics(documentsCount, validDocumentsCount, erroneousDocumentsCount, transactionsCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Array of classification results. + /// A new instance for mocking. + public static DynamicClassificationDocumentResult DynamicClassificationDocumentResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable classifications = null) + { + warnings ??= new List(); + classifications ??= new List(); + + return new DynamicClassificationDocumentResult(id, warnings?.ToList(), statistics, classifications?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// A JSON pointer reference indicating the target object. + /// A new instance for mocking. + public static DocumentWarning DocumentWarning(WarningCode code = default, string message = null, string targetRef = null) + { + return new DocumentWarning(code, message, targetRef, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of text elements recognized in the document. + /// Number of transactions for the document. + /// A new instance for mocking. + public static DocumentStatistics DocumentStatistics(int charactersCount = default, int transactionsCount = default) + { + return new DocumentStatistics(charactersCount, transactionsCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Classification type. + /// Confidence score between 0 and 1 of the recognized class. + /// A new instance for mocking. + public static ClassificationResult ClassificationResult(string category = null, double confidenceScore = default) + { + return new ClassificationResult(category, confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity linking result. + /// A new instance for mocking. + public static AnalyzeTextEntityLinkingResult AnalyzeTextEntityLinkingResult(EntityLinkingResult results = null) + { + return new AnalyzeTextEntityLinkingResult(AnalyzeTextResultsKind.EntityLinkingResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static EntityLinkingResult EntityLinkingResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new EntityLinkingResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized well known entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static EntityLinkingActionResult EntityLinkingActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new EntityLinkingActionResult( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity Linking formal name. + /// List of instances this entity appears in the text. + /// Language used in the data source. + /// Unique identifier of the recognized entity from the data source. + /// URL for the entity's page from the data source. + /// Data source used to extract entity linking, such as Wiki/Bing etc. + /// Bing Entity Search API unique identifier of the recognized entity. + /// A new instance for mocking. + public static LinkedEntity LinkedEntity(string name = null, IEnumerable matches = null, string language = null, string id = null, string url = null, string dataSource = null, string bingId = null) + { + matches ??= new List(); + + return new LinkedEntity( + name, + matches?.ToList(), + language, + id, + url, + dataSource, + bingId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + /// Entity text as appears in the request. + /// Start position for the entity match text. + /// Length for the entity match text. + /// A new instance for mocking. + public static EntityLinkingMatch EntityLinkingMatch(double confidenceScore = default, string text = null, int offset = default, int length = default) + { + return new EntityLinkingMatch(confidenceScore, text, offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// 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. + /// Identifies the script of the input document. + /// Identifies the script of the input document. + /// A new instance for mocking. + public static DetectedLanguage DetectedLanguage(string name = null, string iso6391Name = null, double confidenceScore = default, ScriptKind? script = null, ScriptCode? scriptCode = null) + { + return new DetectedLanguage( + name, + iso6391Name, + confidenceScore, + script, + scriptCode, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Results for entity recognition. + /// A new instance for mocking. + public static AnalyzeTextEntitiesResult AnalyzeTextEntitiesResult(EntitiesResult results = null) + { + return new AnalyzeTextEntitiesResult(AnalyzeTextResultsKind.EntityRecognitionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static EntitiesResult EntitiesResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new EntitiesResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static EntitiesDocumentResultWithMetadataDetectedLanguage EntitiesDocumentResultWithMetadataDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new EntitiesDocumentResultWithMetadataDetectedLanguage( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + /// List of entity tags. Tags are to express some similarities/affinity between entities. + /// + /// The entity metadata object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + /// A new instance for mocking. + public static NamedEntityWithMetadata NamedEntityWithMetadata(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, string type = null, IEnumerable tags = null, BaseMetadata metadata = null) + { + tags ??= new List(); + + return new NamedEntityWithMetadata( + text, + category, + subcategory, + offset, + length, + confidenceScore, + type, + tags?.ToList(), + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the tag. Entity Tag names will be unique globally. + /// Detection score between 0 and 1 of the extracted entity. + /// A new instance for mocking. + public static EntityTag EntityTag(string name = null, double? confidenceScore = null) + { + return new EntityTag(name, confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for age. + /// A new instance for mocking. + public static AgeMetadata AgeMetadata(double value = default, AgeUnit unit = default) + { + return new AgeMetadata(MetadataKind.AgeMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for volume. + /// A new instance for mocking. + public static VolumeMetadata VolumeMetadata(double value = default, VolumeUnit unit = default) + { + return new VolumeMetadata(MetadataKind.VolumeMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for speed. + /// A new instance for mocking. + public static SpeedMetadata SpeedMetadata(double value = default, SpeedUnit unit = default) + { + return new SpeedMetadata(MetadataKind.SpeedMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for area. + /// A new instance for mocking. + public static AreaMetadata AreaMetadata(double value = default, AreaUnit unit = default) + { + return new AreaMetadata(MetadataKind.AreaMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for length. + /// A new instance for mocking. + public static LengthMetadata LengthMetadata(double value = default, LengthUnit unit = default) + { + return new LengthMetadata(MetadataKind.LengthMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for information. + /// A new instance for mocking. + public static InformationMetadata InformationMetadata(double value = default, InformationUnit unit = default) + { + return new InformationMetadata(MetadataKind.InformationMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for temperature. + /// A new instance for mocking. + public static TemperatureMetadata TemperatureMetadata(double value = default, TemperatureUnit unit = default) + { + return new TemperatureMetadata(MetadataKind.TemperatureMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for weight. + /// A new instance for mocking. + public static WeightMetadata WeightMetadata(double value = default, WeightUnit unit = default) + { + return new WeightMetadata(MetadataKind.WeightMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Currency unit. + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + /// A new instance for mocking. + public static CurrencyMetadata CurrencyMetadata(double value = default, string unit = null, string iso4217 = null) + { + return new CurrencyMetadata(MetadataKind.CurrencyMetadata, serializedAdditionalRawData: null, value, unit, iso4217); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static DateMetadata DateMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new DateMetadata(MetadataKind.DateMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The actual time that the extracted text denote. + /// Modifier for datetime to indicate point of reference like before, after etc. + /// A new instance for mocking. + public static DateValue DateValue(string timex = null, string value = null, TemporalModifier? modifier = null) + { + return new DateValue(timex, value, modifier, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static DateTimeMetadata DateTimeMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new DateTimeMetadata(MetadataKind.DateTimeMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static TemporalSetMetadata TemporalSetMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new TemporalSetMetadata(MetadataKind.TemporalSetMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static TimeMetadata TimeMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new TimeMetadata(MetadataKind.TimeMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// Kind of the number type. + /// A numeric representation of what the extracted text denotes. + /// A new instance for mocking. + public static NumberMetadata NumberMetadata(NumberKind numberKind = default, double value = default) + { + return new NumberMetadata(MetadataKind.NumberMetadata, serializedAdditionalRawData: null, numberKind, value); + } + + /// Initializes a new instance of . + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + /// A new instance for mocking. + public static OrdinalMetadata OrdinalMetadata(string offset = null, RelativeTo relativeTo = default, string value = null) + { + return new OrdinalMetadata(MetadataKind.OrdinalMetadata, serializedAdditionalRawData: null, offset, relativeTo, value); + } + + /// Initializes a new instance of . + /// List of temporal spans detected. + /// A new instance for mocking. + public static TemporalSpanMetadata TemporalSpanMetadata(IEnumerable spanValues = null) + { + spanValues ??= new List(); + + return new TemporalSpanMetadata(MetadataKind.TemporalSpanMetadata, serializedAdditionalRawData: null, spanValues?.ToList()); + } + + /// Initializes a new instance of . + /// Start value for the span. + /// End value for the span. + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + /// Modifier for datetime to indicate point of reference like before, after etc. + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + /// A new instance for mocking. + public static TemporalSpanValues TemporalSpanValues(string begin = null, string end = null, string duration = null, TemporalModifier? modifier = null, string timex = null) + { + return new TemporalSpanValues( + begin, + end, + duration, + modifier, + timex, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Kind of numeric ranges supported - like Number, Speed, etc. + /// The beginning value of the interval. + /// The ending value of the interval. + /// The inclusiveness of this range. + /// A new instance for mocking. + public static NumericRangeMetadata NumericRangeMetadata(RangeKind rangeKind = default, double minimum = default, double maximum = default, RangeInclusivity? rangeInclusivity = null) + { + return new NumericRangeMetadata( + MetadataKind.NumericRangeMetadata, + serializedAdditionalRawData: null, + rangeKind, + minimum, + maximum, + rangeInclusivity); + } + + /// Initializes a new instance of . + /// The list of Key phrase extraction results. + /// A new instance for mocking. + public static AnalyzeTextKeyPhraseResult AnalyzeTextKeyPhraseResult(KeyPhraseResult results = null) + { + return new AnalyzeTextKeyPhraseResult(AnalyzeTextResultsKind.KeyPhraseExtractionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static KeyPhraseResult KeyPhraseResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new KeyPhraseResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static KeyPhrasesActionResult KeyPhrasesActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable keyPhrases = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + keyPhrases ??= new List(); + + return new KeyPhrasesActionResult( + id, + warnings?.ToList(), + statistics, + keyPhrases?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Contains the language detection results. + /// A new instance for mocking. + public static AnalyzeTextLanguageDetectionResult AnalyzeTextLanguageDetectionResult(LanguageDetectionResult results = null) + { + return new AnalyzeTextLanguageDetectionResult(AnalyzeTextResultsKind.LanguageDetectionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Enumeration of language detection results for each input document. + /// A new instance for mocking. + public static LanguageDetectionResult LanguageDetectionResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new LanguageDetectionResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Detected Language. + /// A new instance for mocking. + public static LanguageDetectionDocumentResult LanguageDetectionDocumentResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + + return new LanguageDetectionDocumentResult(id, warnings?.ToList(), statistics, detectedLanguage, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The list of pii results. + /// A new instance for mocking. + public static AnalyzeTextPiiResult AnalyzeTextPiiResult(PiiResult results = null) + { + return new AnalyzeTextPiiResult(AnalyzeTextResultsKind.PiiEntityRecognitionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static PiiResult PiiResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new PiiResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Returns redacted text. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static PiiActionResult PiiActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, string redactedText = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new PiiActionResult( + id, + warnings?.ToList(), + statistics, + redactedText, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// A new instance for mocking. + public static NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default) + { + return new NamedEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentiment analysis results. + /// A new instance for mocking. + public static AnalyzeTextSentimentResult AnalyzeTextSentimentResult(SentimentResult results = null) + { + return new AnalyzeTextSentimentResult(AnalyzeTextResultsKind.SentimentAnalysisResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// The sentiment analysis results for each document in the input. + /// A new instance for mocking. + public static SentimentResult SentimentResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new SentimentResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static SentimentActionResult SentimentActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DocumentSentiment sentiment = default, SentimentConfidenceScores confidenceScores = null, IEnumerable sentences = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + sentences ??= new List(); + + return new SentimentActionResult( + id, + warnings?.ToList(), + statistics, + sentiment, + confidenceScores, + sentences?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for neutral sentiment. + /// Confidence score for negative sentiment. + /// A new instance for mocking. + public static SentimentConfidenceScores SentimentConfidenceScores(double positive = default, double neutral = default, double negative = default) + { + return new SentimentConfidenceScores(positive, neutral, negative, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The array of sentence targets for the sentence. + /// The array of assessments for the sentence. + /// A new instance for mocking. + public static SentenceSentiment SentenceSentiment(string text = null, SentenceSentimentValue sentiment = default, SentimentConfidenceScores confidenceScores = null, int offset = default, int length = default, IEnumerable targets = null, IEnumerable assessments = null) + { + targets ??= new List(); + assessments ??= new List(); + + return new SentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + targets?.ToList(), + assessments?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The array of either assessment or target objects which is related to the target. + /// A new instance for mocking. + public static SentenceTarget SentenceTarget(TokenSentiment sentiment = default, TargetConfidenceScoreLabel confidenceScores = null, int offset = default, int length = default, string text = null, IEnumerable relations = null) + { + relations ??= new List(); + + return new SentenceTarget( + sentiment, + confidenceScores, + offset, + length, + text, + relations?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for negative sentiment. + /// A new instance for mocking. + public static TargetConfidenceScoreLabel TargetConfidenceScoreLabel(double positive = default, double negative = default) + { + return new TargetConfidenceScoreLabel(positive, negative, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The JSON pointer indicating the linked object. + /// The type related to the target. + /// A new instance for mocking. + public static TargetRelation TargetRelation(string @ref = null, TargetRelationType relationType = default) + { + return new TargetRelation(@ref, relationType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The indicator representing if the assessment is negated. + /// A new instance for mocking. + public static SentenceAssessment SentenceAssessment(TokenSentiment sentiment = default, TargetConfidenceScoreLabel confidenceScores = null, int offset = default, int length = default, string text = null, bool isNegated = default) + { + return new SentenceAssessment( + sentiment, + confidenceScores, + offset, + length, + text, + isNegated, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// display name. + /// Date and time job created. + /// Date and time job expires. + /// job ID. + /// last updated date and time. + /// status. + /// errors. + /// next link. + /// List of tasks. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// A new instance for mocking. + public static AnalyzeTextOperationState AnalyzeTextOperationState(string displayName = null, DateTimeOffset createdAt = default, DateTimeOffset? expiresOn = null, Guid jobId = default, DateTimeOffset lastUpdatedAt = default, TextActionState status = default, IEnumerable errors = null, string nextLink = null, TextActions actions = null, RequestStatistics statistics = null) + { + errors ??= new List(); + + return new AnalyzeTextOperationState( + displayName, + createdAt, + expiresOn, + jobId, + lastUpdatedAt, + status, + errors?.ToList(), + nextLink, + actions, + statistics, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + /// + /// Enumerable of Analyze text job results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// A new instance for mocking. + public static TextActions TextActions(int completed = default, int failed = default, int inProgress = default, int total = default, IEnumerable items = null) + { + items ??= new List(); + + return new TextActions( + completed, + failed, + inProgress, + total, + items?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// A new instance for mocking. + public static AnalyzeTextOperationResult AnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, string kind = null) + { + return new UnknownAnalyzeTextOperationResult(lastUpdateDateTime, status, name, kind == null ? default : new AnalyzeTextOperationResultsKind(kind), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// List of results. + /// A new instance for mocking. + public static CustomEntityRecognitionOperationResult CustomEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomEntitiesActionResult results = null) + { + return new CustomEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomEntityRecognitionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Enumeration of the document results with detected language. + /// A new instance for mocking. + public static CustomEntitiesActionResult CustomEntitiesActionResult(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomEntitiesActionResult( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static EntityActionResult EntityActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new EntityActionResult( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// List of results. + /// A new instance for mocking. + public static CustomSingleLabelClassificationOperationResult CustomSingleLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomLabelClassificationActionResult results = null) + { + return new CustomSingleLabelClassificationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomSingleLabelClassificationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Response by document. + /// A new instance for mocking. + public static CustomLabelClassificationActionResult CustomLabelClassificationActionResult(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomLabelClassificationActionResult( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Contains the classification doc results for all docs. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static ClassificationActionResult ClassificationActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable @class = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + @class ??= new List(); + + return new ClassificationActionResult( + id, + warnings?.ToList(), + statistics, + @class?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// List of results. + /// A new instance for mocking. + public static CustomMultiLabelClassificationOperationResult CustomMultiLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomLabelClassificationActionResult results = null) + { + return new CustomMultiLabelClassificationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomMultiLabelClassificationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Entity linking result. + /// A new instance for mocking. + public static EntityLinkingOperationResult EntityLinkingOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, EntityLinkingResult results = null) + { + return new EntityLinkingOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.EntityLinkingOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results for the task. + /// A new instance for mocking. + public static EntityRecognitionOperationResult EntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, EntitiesResult results = null) + { + return new EntityRecognitionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.EntityRecognitionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static HealthcareOperationResult HealthcareOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, HealthcareResult results = null) + { + return new HealthcareOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.HealthcareOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// List of result objects for the processed Healthcare documents. + /// A new instance for mocking. + public static HealthcareResult HealthcareResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new HealthcareResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static HealthcareActionResult HealthcareActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, IEnumerable relations = null, FhirBundle fhirBundle = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + relations ??= new List(); + + return new HealthcareActionResult( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + relations?.ToList(), + fhirBundle, + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// A new instance for mocking. + public static HealthcareEntity HealthcareEntity(string text = null, HealthcareEntityCategory category = default, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, HealthcareAssertion assertion = null, string name = null, IEnumerable links = null) + { + links ??= new List(); + + return new HealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Describes any conditionality on the entity. + /// Describes the entities certainty and polarity. + /// Describes if the entity is the subject of the text or if it describes someone else. + /// Describes temporal information regarding the entity. + /// A new instance for mocking. + public static HealthcareAssertion HealthcareAssertion(HealthcareAssertionConditionality? conditionality = null, HealthcareAssertionCertainty? certainty = null, HealthcareAssertionAssociation? association = null, HealthcareAssertionTemporality? temporality = null) + { + return new HealthcareAssertion(conditionality, certainty, association, temporality, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + /// Entity id in the given source catalog. + /// A new instance for mocking. + public static HealthcareEntityLink HealthcareEntityLink(string dataSource = null, string id = null) + { + return new HealthcareEntityLink(dataSource, id, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + /// The entities in the relation. + /// Confidence score between 0 and 1 of the extracted relation. + /// A new instance for mocking. + public static HealthcareRelation HealthcareRelation(RelationType relationType = default, IEnumerable entities = null, double? confidenceScore = null) + { + entities ??= new List(); + + return new HealthcareRelation(relationType, entities?.ToList(), confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + /// A new instance for mocking. + public static HealthcareRelationEntity HealthcareRelationEntity(string @ref = null, string role = null) + { + return new HealthcareRelationEntity(@ref, role, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Additional Properties. + /// A new instance for mocking. + public static FhirBundle FhirBundle(IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new FhirBundle(additionalProperties); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// The list of Key phrase extraction results. + /// A new instance for mocking. + public static KeyPhraseExtractionOperationResult KeyPhraseExtractionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, KeyPhraseResult results = null) + { + return new KeyPhraseExtractionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.KeyPhraseExtractionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// The list of pii results. + /// A new instance for mocking. + public static PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, PiiResult results = null) + { + return new PiiEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.PiiEntityRecognitionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// The sentiment analysis results. + /// A new instance for mocking. + public static SentimentOperationResult SentimentOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, SentimentResult results = null) + { + return new SentimentOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.SentimentAnalysisOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static CustomSentimentAnalysisOperationResult CustomSentimentAnalysisOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomSentimentAnalysisResult results = null) + { + return new CustomSentimentAnalysisOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomSentimentAnalysisOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// The custom sentiment analysis results for each document in the input. + /// A new instance for mocking. + public static CustomSentimentAnalysisResult CustomSentimentAnalysisResult(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomSentimentAnalysisResult( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static CustomSentimentAnalysisResultDocument CustomSentimentAnalysisResultDocument(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DocumentSentiment sentiment = default, SentimentConfidenceScores confidenceScores = null, IEnumerable sentences = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + sentences ??= new List(); + + return new CustomSentimentAnalysisResultDocument( + id, + warnings?.ToList(), + statistics, + sentiment, + confidenceScores, + sentences?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// A new instance for mocking. + public static CustomSentenceSentiment CustomSentenceSentiment(string text = null, SentenceSentimentValue sentiment = default, SentimentConfidenceScores confidenceScores = null, int offset = default, int length = default) + { + return new CustomSentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, ExtractiveSummarizationResult results = null) + { + return new ExtractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.ExtractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static ExtractiveSummarizationResult ExtractiveSummarizationResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new ExtractiveSummarizationResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Specifies the the extracted sentences from the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static ExtractedSummaryActionResult ExtractedSummaryActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable sentences = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + sentences ??= new List(); + + return new ExtractedSummaryActionResult( + id, + warnings?.ToList(), + statistics, + sentences?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The extracted sentence text. + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + /// The length of the sentence. + /// A new instance for mocking. + public static ExtractedSummarySentence ExtractedSummarySentence(string text = null, double rankScore = default, int offset = default, int length = default) + { + return new ExtractedSummarySentence(text, rankScore, offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, AbstractiveSummarizationResult results = null) + { + return new AbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.AbstractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static AbstractiveSummarizationResult AbstractiveSummarizationResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new AbstractiveSummarizationResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of abstractive summaries. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static AbstractiveSummaryActionResult AbstractiveSummaryActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable summaries = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + summaries ??= new List(); + + return new AbstractiveSummaryActionResult( + id, + warnings?.ToList(), + statistics, + summaries?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The text of the summary. + /// The context list of the summary. + /// A new instance for mocking. + public static AbstractiveSummary AbstractiveSummary(string text = null, IEnumerable contexts = null) + { + contexts ??= new List(); + + return new AbstractiveSummary(text, contexts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// A new instance for mocking. + public static SummaryContext SummaryContext(int offset = default, int length = default) + { + return new SummaryContext(offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationOperationResult CustomAbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomAbstractiveSummarizationResult results = null) + { + return new CustomAbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomAbstractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Response by document. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationResult CustomAbstractiveSummarizationResult(IEnumerable documents = null, IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null) + { + documents ??= new List(); + errors ??= new List(); + + return new CustomAbstractiveSummarizationResult( + documents?.ToList(), + errors?.ToList(), + statistics, + projectName, + deploymentName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Contains the list of document results. + /// A new instance for mocking. + public static CustomHealthcareOperationResult CustomHealthcareOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomHealthcareResult results = null) + { + return new CustomHealthcareOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomHealthcareOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// List of custom healthcare results for the document. + /// A new instance for mocking. + public static CustomHealthcareResult CustomHealthcareResult(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomHealthcareResult( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static CustomHealthcareActionResult CustomHealthcareActionResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, IEnumerable relations = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + relations ??= new List(); + + return new CustomHealthcareActionResult( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + relations?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// + /// (Optional) Entity component information listing fired components of the extracted entity. This object only applies for custom healthcare. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static CustomHealthcareEntity CustomHealthcareEntity(string text = null, HealthcareEntityCategory category = default, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, HealthcareAssertion assertion = null, string name = null, IEnumerable links = null, IEnumerable entityComponentInformation = null) + { + links ??= new List(); + entityComponentInformation ??= new List(); + + return new CustomHealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links?.ToList(), + entityComponentInformation?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The prebuilt component of an extracted entity type. + /// A new instance for mocking. + public static PrebuiltComponent PrebuiltComponent(string value = null) + { + return new PrebuiltComponent(EntityComponentKind.PrebuiltComponent, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// The learned component of an extracted entity type. + /// A new instance for mocking. + public static LearnedComponent LearnedComponent(string value = null) + { + return new LearnedComponent(EntityComponentKind.LearnedComponent, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// The list key of an extracted entity type. + /// A new instance for mocking. + public static ListComponent ListComponent(string value = null) + { + return new ListComponent(EntityComponentKind.ListComponent, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// A new instance for mocking. + public static CustomEntitiesActionContent CustomEntitiesActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new CustomEntitiesActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomSingleLabelClassificationActionContent CustomSingleLabelClassificationActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null) + { + return new CustomSingleLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomMultiLabelClassificationActionContent CustomMultiLabelClassificationActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null) + { + return new CustomMultiLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Specifies the method used to interpret string offsets. + /// A new instance for mocking. + public static CustomSentimentAnalysisActionContent CustomSentimentAnalysisActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new CustomSentimentAnalysisActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// task name. + /// Parameters for the Custom Abstractive Summarization task. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationOperationAction CustomAbstractiveSummarizationOperationAction(string name = null, CustomAbstractiveSummarizationActionContent actionContent = null) + { + return new CustomAbstractiveSummarizationOperationAction(name, AnalyzeTextOperationActionKind.CustomAbstractiveSummarization, serializedAdditionalRawData: null, actionContent); + } + + /// Initializes a new instance of . + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationActionContent CustomAbstractiveSummarizationActionContent(int? sentenceCount = null, StringIndexType? stringIndexType = null, SummaryLengthBucket? summaryLength = null, bool? loggingOptOut = null, string projectName = null, string deploymentName = null) + { + return new CustomAbstractiveSummarizationActionContent( + sentenceCount, + stringIndexType, + summaryLength, + loggingOptOut, + projectName, + deploymentName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// A new instance for mocking. + public static CustomHealthcareActionContent CustomHealthcareActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new CustomHealthcareActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 000000000000..ae5a8b07f083 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationActionContent.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(SentenceCount)) + { + writer.WritePropertyName("sentenceCount"u8); + writer.WriteNumberValue(SentenceCount.Value); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(SummaryLength)) + { + writer.WritePropertyName("summaryLength"u8); + writer.WriteStringValue(SummaryLength.Value.ToString()); + } + if (Optional.IsDefined(Query)) + { + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AbstractiveSummarizationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationActionContent(document.RootElement, options); + } + + internal static AbstractiveSummarizationActionContent DeserializeAbstractiveSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + int? sentenceCount = default; + StringIndexType? stringIndexType = default; + SummaryLengthBucket? summaryLength = default; + string query = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentenceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("summaryLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + summaryLength = new SummaryLengthBucket(property.Value.GetString()); + continue; + } + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationActionContent( + loggingOptOut, + modelVersion, + sentenceCount, + stringIndexType, + summaryLength, + query, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationActionContent.cs new file mode 100644 index 000000000000..3214056135ad --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationActionContent.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for the pre-built Abstractive Summarization task. + public partial class AbstractiveSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AbstractiveSummarizationActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + /// (Optional) If provided, the query will be used to generate the summary. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummarizationActionContent(bool? loggingOptOut, string modelVersion, int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, string query, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + Query = query; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Controls the approximate number of sentences in the output summaries. + public int? SentenceCount { get; set; } + /// String index type. + public StringIndexType? StringIndexType { get; set; } + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + public SummaryLengthBucket? SummaryLength { get; set; } + /// (Optional) If provided, the query will be used to generate the summary. + public string Query { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 000000000000..1f158b1c709f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + AbstractiveSummarizationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationOperationAction(document.RootElement, options); + } + + internal static AbstractiveSummarizationOperationAction DeserializeAbstractiveSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AbstractiveSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = AbstractiveSummarizationActionContent.DeserializeAbstractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AbstractiveSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationAction.cs new file mode 100644 index 000000000000..96b63b374ccb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the task definition for an Abstractive Summarization task. + public partial class AbstractiveSummarizationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public AbstractiveSummarizationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.AbstractiveSummarization; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Abstractive Summarization task. + internal AbstractiveSummarizationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, AbstractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Abstractive Summarization task. + public AbstractiveSummarizationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 000000000000..899891213291 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AbstractiveSummarizationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationOperationResult(document.RootElement, options); + } + + internal static AbstractiveSummarizationOperationResult DeserializeAbstractiveSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AbstractiveSummarizationResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = AbstractiveSummarizationResult.DeserializeAbstractiveSummarizationResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AbstractiveSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationResult.cs new file mode 100644 index 000000000000..e18832ba849b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the results for an Abstractive Summarization task. + public partial class AbstractiveSummarizationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.AbstractiveSummarizationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public AbstractiveSummarizationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationResult.Serialization.cs new file mode 100644 index 000000000000..f0c9eb5e6b82 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummarizationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AbstractiveSummarizationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationResult(document.RootElement, options); + } + + internal static AbstractiveSummarizationResult DeserializeAbstractiveSummarizationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummaryActionResult.DeserializeAbstractiveSummaryActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummarizationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationResult.cs new file mode 100644 index 000000000000..3fdbedfd4d72 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummarizationResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// An object representing the pre-built Abstractive Summarization results of each document. + public partial class AbstractiveSummarizationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal AbstractiveSummarizationResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummarizationResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummarizationResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummary.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummary.Serialization.cs new file mode 100644 index 000000000000..6615cc74a7a7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummary.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummary : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (Optional.IsCollectionDefined(Contexts)) + { + writer.WritePropertyName("contexts"u8); + writer.WriteStartArray(); + foreach (var item in Contexts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AbstractiveSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummary(document.RootElement, options); + } + + internal static AbstractiveSummary DeserializeAbstractiveSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + IReadOnlyList contexts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("contexts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SummaryContext.DeserializeSummaryContext(item, options)); + } + contexts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummary(text, contexts ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummary FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummary(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummary.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummary.cs new file mode 100644 index 000000000000..ec33a2c6c356 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummary.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing a single summary with context for given document. + public partial class AbstractiveSummary + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The text of the summary. + /// is null. + internal AbstractiveSummary(string text) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + Contexts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The text of the summary. + /// The context list of the summary. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummary(string text, IReadOnlyList contexts, IDictionary serializedAdditionalRawData) + { + Text = text; + Contexts = contexts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummary() + { + } + + /// The text of the summary. + public string Text { get; } + /// The context list of the summary. + public IReadOnlyList Contexts { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummaryActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummaryActionResult.Serialization.cs new file mode 100644 index 000000000000..48c259622a77 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummaryActionResult.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AbstractiveSummaryActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummaryActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("summaries"u8); + writer.WriteStartArray(); + foreach (var item in Summaries) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AbstractiveSummaryActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummaryActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummaryActionResult(document.RootElement, options); + } + + internal static AbstractiveSummaryActionResult DeserializeAbstractiveSummaryActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList summaries = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("summaries"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummary.DeserializeAbstractiveSummary(item, options)); + } + summaries = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummaryActionResult( + id, + warnings, + statistics, + summaries, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummaryActionResult)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummaryActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummaryActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummaryActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummaryActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummaryActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummaryActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummaryActionResult.cs new file mode 100644 index 000000000000..d054eb2a4ee6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AbstractiveSummaryActionResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// An object representing the Abstractive Summarization result of a single document with detected language. + public partial class AbstractiveSummaryActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// A list of abstractive summaries. + /// , or is null. + internal AbstractiveSummaryActionResult(string id, IEnumerable warnings, IEnumerable summaries) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(summaries, nameof(summaries)); + + Id = id; + Warnings = warnings.ToList(); + Summaries = summaries.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of abstractive summaries. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummaryActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList summaries, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Summaries = summaries; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummaryActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// A list of abstractive summaries. + public IReadOnlyList Summaries { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeMetadata.Serialization.cs new file mode 100644 index 000000000000..7b04fe24e3f7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AgeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgeMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + AgeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgeMetadata(document.RootElement, options); + } + + internal static AgeMetadata DeserializeAgeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + AgeUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new AgeUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgeMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgeMetadata)} does not support writing '{options.Format}' format."); + } + } + + AgeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AgeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAgeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeMetadata.cs new file mode 100644 index 000000000000..a4d67427c2b2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Age entity Metadata model. + public partial class AgeMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for age. + internal AgeMetadata(double value, AgeUnit unit) + { + MetadataKind = MetadataKind.AgeMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for age. + internal AgeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, AgeUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal AgeMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for age. + public AgeUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeUnit.cs new file mode 100644 index 000000000000..d42f1b3bc235 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AgeUnit.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The Age Unit of measurement. + public readonly partial struct AgeUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgeUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string YearValue = "Year"; + private const string MonthValue = "Month"; + private const string WeekValue = "Week"; + private const string DayValue = "Day"; + + /// Unspecified time period. + public static AgeUnit Unspecified { get; } = new AgeUnit(UnspecifiedValue); + /// Time period of a year. + public static AgeUnit Year { get; } = new AgeUnit(YearValue); + /// Time period of a month. + public static AgeUnit Month { get; } = new AgeUnit(MonthValue); + /// Time period of a week. + public static AgeUnit Week { get; } = new AgeUnit(WeekValue); + /// Time period of a day. + public static AgeUnit Day { get; } = new AgeUnit(DayValue); + /// Determines if two values are the same. + public static bool operator ==(AgeUnit left, AgeUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgeUnit left, AgeUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgeUnit(string value) => new AgeUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgeUnit other && Equals(other); + /// + public bool Equals(AgeUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AllowOverlapEntityPolicyType.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AllowOverlapEntityPolicyType.Serialization.cs new file mode 100644 index 000000000000..c3412cdbd955 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AllowOverlapEntityPolicyType.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AllowOverlapEntityPolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AllowOverlapEntityPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAllowOverlapEntityPolicyType(document.RootElement, options); + } + + internal static AllowOverlapEntityPolicyType DeserializeAllowOverlapEntityPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new PolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AllowOverlapEntityPolicyType(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support writing '{options.Format}' format."); + } + } + + AllowOverlapEntityPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAllowOverlapEntityPolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AllowOverlapEntityPolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAllowOverlapEntityPolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AllowOverlapEntityPolicyType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AllowOverlapEntityPolicyType.cs new file mode 100644 index 000000000000..2363e8b6ee9f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AllowOverlapEntityPolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the allow overlap policy. Will apply no post processing logic for the entities. Whatever the model predicts is what will be returned to the user. This allows the user to get a full view of every single model's possible values and apply their own custom logic on entity selection. + public partial class AllowOverlapEntityPolicyType : EntityOverlapPolicy + { + /// Initializes a new instance of . + public AllowOverlapEntityPolicyType() + { + PolicyKind = PolicyKind.AllowOverlap; + } + + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal AllowOverlapEntityPolicyType(PolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextDynamicClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextDynamicClassificationResult.Serialization.cs new file mode 100644 index 000000000000..6ed0d4ba2057 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextDynamicClassificationResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextDynamicClassificationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextDynamicClassificationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextDynamicClassificationResult(document.RootElement, options); + } + + internal static AnalyzeTextDynamicClassificationResult DeserializeAnalyzeTextDynamicClassificationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DynamicClassificationResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = DynamicClassificationResult.DeserializeDynamicClassificationResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextDynamicClassificationResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextDynamicClassificationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextDynamicClassificationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextDynamicClassificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextDynamicClassificationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextDynamicClassificationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextDynamicClassificationResult.cs new file mode 100644 index 000000000000..d66c33dadeb5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextDynamicClassificationResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Result for Dynamic Classification task. + public partial class AnalyzeTextDynamicClassificationResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Results for Dynamic Classification task. + /// is null. + internal AnalyzeTextDynamicClassificationResult(DynamicClassificationResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.DynamicClassificationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Results for Dynamic Classification task. + internal AnalyzeTextDynamicClassificationResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, DynamicClassificationResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextDynamicClassificationResult() + { + } + + /// Results for Dynamic Classification task. + public DynamicClassificationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntitiesResult.Serialization.cs new file mode 100644 index 000000000000..ad230d1ed166 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntitiesResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextEntitiesResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextEntitiesResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextEntitiesResult(document.RootElement, options); + } + + internal static AnalyzeTextEntitiesResult DeserializeAnalyzeTextEntitiesResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntitiesResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntitiesResult.DeserializeEntitiesResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextEntitiesResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextEntitiesResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextEntitiesResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextEntitiesResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextEntitiesResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntitiesResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntitiesResult.cs new file mode 100644 index 000000000000..696dd36427d0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntitiesResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the entity task. + public partial class AnalyzeTextEntitiesResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Results for entity recognition. + /// is null. + internal AnalyzeTextEntitiesResult(EntitiesResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.EntityRecognitionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Results for entity recognition. + internal AnalyzeTextEntitiesResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, EntitiesResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextEntitiesResult() + { + } + + /// Results for entity recognition. + public EntitiesResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntityLinkingResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntityLinkingResult.Serialization.cs new file mode 100644 index 000000000000..18abd889e794 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntityLinkingResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextEntityLinkingResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextEntityLinkingResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextEntityLinkingResult(document.RootElement, options); + } + + internal static AnalyzeTextEntityLinkingResult DeserializeAnalyzeTextEntityLinkingResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityLinkingResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntityLinkingResult.DeserializeEntityLinkingResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextEntityLinkingResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextEntityLinkingResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextEntityLinkingResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextEntityLinkingResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextEntityLinkingResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntityLinkingResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntityLinkingResult.cs new file mode 100644 index 000000000000..fcc9c2f9715f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextEntityLinkingResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text Entity linking task result. + public partial class AnalyzeTextEntityLinkingResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Entity linking result. + /// is null. + internal AnalyzeTextEntityLinkingResult(EntityLinkingResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.EntityLinkingResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Entity linking result. + internal AnalyzeTextEntityLinkingResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, EntityLinkingResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextEntityLinkingResult() + { + } + + /// Entity linking result. + public EntityLinkingResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextError.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextError.Serialization.cs new file mode 100644 index 000000000000..f07cfbead8e2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextError.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Innererror)) + { + writer.WritePropertyName("innererror"u8); + writer.WriteObjectValue(Innererror, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextError(document.RootElement, options); + } + + internal static AnalyzeTextError DeserializeAnalyzeTextError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeTextErrorCode code = default; + string message = default; + string target = default; + IReadOnlyList details = default; + InnerErrorModel innererror = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new AnalyzeTextErrorCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeAnalyzeTextError(item, options)); + } + details = array; + continue; + } + if (property.NameEquals("innererror"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + innererror = InnerErrorModel.DeserializeInnerErrorModel(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextError( + code, + message, + target, + details ?? new ChangeTrackingList(), + innererror, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextError.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextError.cs new file mode 100644 index 000000000000..a3fd1d986378 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextError.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The error response object returned when the service encounters some errors during processing the request. + public partial class AnalyzeTextError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// A human-readable representation of the error. + /// is null. + internal AnalyzeTextError(AnalyzeTextErrorCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + Details = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// A human-readable representation of the error. + /// The target of the error. + /// An array of details about specific errors that led to this reported error. + /// An object containing more specific information than the current object about the error. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextError(AnalyzeTextErrorCode code, string message, string target, IReadOnlyList details, InnerErrorModel innererror, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Target = target; + Details = details; + Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextError() + { + } + + /// One of a server-defined set of error codes. + public AnalyzeTextErrorCode Code { get; } + /// A human-readable representation of the error. + public string Message { get; } + /// The target of the error. + public string Target { get; } + /// An array of details about specific errors that led to this reported error. + public IReadOnlyList Details { get; } + /// An object containing more specific information than the current object about the error. + public InnerErrorModel Innererror { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextErrorCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextErrorCode.cs new file mode 100644 index 000000000000..6c0a3f662d16 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextErrorCode.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Human-readable error code. + public readonly partial struct AnalyzeTextErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextErrorCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidRequestValue = "InvalidRequest"; + private const string InvalidArgumentValue = "InvalidArgument"; + private const string UnauthorizedValue = "Unauthorized"; + private const string ForbiddenValue = "Forbidden"; + private const string NotFoundValue = "NotFound"; + private const string ProjectNotFoundValue = "ProjectNotFound"; + private const string OperationNotFoundValue = "OperationNotFound"; + private const string AzureCognitiveSearchNotFoundValue = "AzureCognitiveSearchNotFound"; + private const string AzureCognitiveSearchIndexNotFoundValue = "AzureCognitiveSearchIndexNotFound"; + private const string TooManyRequestsValue = "TooManyRequests"; + private const string AzureCognitiveSearchThrottlingValue = "AzureCognitiveSearchThrottling"; + private const string AzureCognitiveSearchIndexLimitReachedValue = "AzureCognitiveSearchIndexLimitReached"; + private const string InternalServerErrorValue = "InternalServerError"; + private const string ServiceUnavailableValue = "ServiceUnavailable"; + private const string TimeoutValue = "Timeout"; + private const string QuotaExceededValue = "QuotaExceeded"; + private const string ConflictValue = "Conflict"; + private const string WarningValue = "Warning"; + + /// Invalid request error. + public static AnalyzeTextErrorCode InvalidRequest { get; } = new AnalyzeTextErrorCode(InvalidRequestValue); + /// Invalid argument error. + public static AnalyzeTextErrorCode InvalidArgument { get; } = new AnalyzeTextErrorCode(InvalidArgumentValue); + /// Unauthorized access error. + public static AnalyzeTextErrorCode Unauthorized { get; } = new AnalyzeTextErrorCode(UnauthorizedValue); + /// Forbidden access error. + public static AnalyzeTextErrorCode Forbidden { get; } = new AnalyzeTextErrorCode(ForbiddenValue); + /// Not found error. + public static AnalyzeTextErrorCode NotFound { get; } = new AnalyzeTextErrorCode(NotFoundValue); + /// Project not found error. + public static AnalyzeTextErrorCode ProjectNotFound { get; } = new AnalyzeTextErrorCode(ProjectNotFoundValue); + /// Operation not found error. + public static AnalyzeTextErrorCode OperationNotFound { get; } = new AnalyzeTextErrorCode(OperationNotFoundValue); + /// Azure Cognitive Search not found error. + public static AnalyzeTextErrorCode AzureCognitiveSearchNotFound { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchNotFoundValue); + /// Azure Cognitive Search index not found error. + public static AnalyzeTextErrorCode AzureCognitiveSearchIndexNotFound { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchIndexNotFoundValue); + /// Too many requests error. + public static AnalyzeTextErrorCode TooManyRequests { get; } = new AnalyzeTextErrorCode(TooManyRequestsValue); + /// Azure Cognitive Search throttling error. + public static AnalyzeTextErrorCode AzureCognitiveSearchThrottling { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchThrottlingValue); + /// Azure Cognitive Search index limit reached error. + public static AnalyzeTextErrorCode AzureCognitiveSearchIndexLimitReached { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchIndexLimitReachedValue); + /// Internal server error. + public static AnalyzeTextErrorCode InternalServerError { get; } = new AnalyzeTextErrorCode(InternalServerErrorValue); + /// Service unavailable error. + public static AnalyzeTextErrorCode ServiceUnavailable { get; } = new AnalyzeTextErrorCode(ServiceUnavailableValue); + /// Timeout error. + public static AnalyzeTextErrorCode Timeout { get; } = new AnalyzeTextErrorCode(TimeoutValue); + /// Quota exceeded error. + public static AnalyzeTextErrorCode QuotaExceeded { get; } = new AnalyzeTextErrorCode(QuotaExceededValue); + /// Conflict error. + public static AnalyzeTextErrorCode Conflict { get; } = new AnalyzeTextErrorCode(ConflictValue); + /// Warning error. + public static AnalyzeTextErrorCode Warning { get; } = new AnalyzeTextErrorCode(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextErrorCode left, AnalyzeTextErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextErrorCode left, AnalyzeTextErrorCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeTextErrorCode(string value) => new AnalyzeTextErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextErrorCode other && Equals(other); + /// + public bool Equals(AnalyzeTextErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInput.Serialization.cs new file mode 100644 index 000000000000..bd1955bbbfe7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInput.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextInput))] + public partial class AnalyzeTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + + internal static AnalyzeTextInput DeserializeAnalyzeTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DynamicClassification": return TextDynamicClassificationInput.DeserializeTextDynamicClassificationInput(element, options); + case "EntityLinking": return TextEntityLinkingInput.DeserializeTextEntityLinkingInput(element, options); + case "EntityRecognition": return TextEntityRecognitionInput.DeserializeTextEntityRecognitionInput(element, options); + case "KeyPhraseExtraction": return TextKeyPhraseExtractionInput.DeserializeTextKeyPhraseExtractionInput(element, options); + case "LanguageDetection": return TextLanguageDetectionInput.DeserializeTextLanguageDetectionInput(element, options); + case "PiiEntityRecognition": return TextPiiEntitiesRecognitionInput.DeserializeTextPiiEntitiesRecognitionInput(element, options); + case "SentimentAnalysis": return TextSentimentAnalysisInput.DeserializeTextSentimentAnalysisInput(element, options); + } + } + return UnknownAnalyzeTextInput.DeserializeUnknownAnalyzeTextInput(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInput.cs new file mode 100644 index 000000000000..acaec40e815b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInput.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// Collection of documents to analyze and a single task to execute. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public abstract partial class AnalyzeTextInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AnalyzeTextInput() + { + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The kind of task to perform. + internal AnalyzeTextInputKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInputKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInputKind.cs new file mode 100644 index 000000000000..81f50e97dcea --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextInputKind.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The kind of the analyze-text tasks supported. + internal readonly partial struct AnalyzeTextInputKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextInputKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisValue = "SentimentAnalysis"; + private const string EntityRecognitionValue = "EntityRecognition"; + private const string PiiEntityRecognitionValue = "PiiEntityRecognition"; + private const string KeyPhraseExtractionValue = "KeyPhraseExtraction"; + private const string LanguageDetectionValue = "LanguageDetection"; + private const string EntityLinkingValue = "EntityLinking"; + private const string DynamicClassificationValue = "DynamicClassification"; + + /// Sentiment analysis task. + public static AnalyzeTextInputKind SentimentAnalysis { get; } = new AnalyzeTextInputKind(SentimentAnalysisValue); + /// Entity recognition task. + public static AnalyzeTextInputKind EntityRecognition { get; } = new AnalyzeTextInputKind(EntityRecognitionValue); + /// PII entity recognition task. + public static AnalyzeTextInputKind PiiEntityRecognition { get; } = new AnalyzeTextInputKind(PiiEntityRecognitionValue); + /// Key phrase extraction task. + public static AnalyzeTextInputKind KeyPhraseExtraction { get; } = new AnalyzeTextInputKind(KeyPhraseExtractionValue); + /// Language detection task. + public static AnalyzeTextInputKind LanguageDetection { get; } = new AnalyzeTextInputKind(LanguageDetectionValue); + /// Entity linking task. + public static AnalyzeTextInputKind EntityLinking { get; } = new AnalyzeTextInputKind(EntityLinkingValue); + /// Dynamic classification task. + public static AnalyzeTextInputKind DynamicClassification { get; } = new AnalyzeTextInputKind(DynamicClassificationValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextInputKind left, AnalyzeTextInputKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextInputKind left, AnalyzeTextInputKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeTextInputKind(string value) => new AnalyzeTextInputKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextInputKind other && Equals(other); + /// + public bool Equals(AnalyzeTextInputKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextKeyPhraseResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextKeyPhraseResult.Serialization.cs new file mode 100644 index 000000000000..9e99fd3d0b8d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextKeyPhraseResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextKeyPhraseResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextKeyPhraseResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextKeyPhraseResult(document.RootElement, options); + } + + internal static AnalyzeTextKeyPhraseResult DeserializeAnalyzeTextKeyPhraseResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyPhraseResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = KeyPhraseResult.DeserializeKeyPhraseResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextKeyPhraseResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextKeyPhraseResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextKeyPhraseResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextKeyPhraseResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextKeyPhraseResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextKeyPhraseResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextKeyPhraseResult.cs new file mode 100644 index 000000000000..4ca69a89552d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextKeyPhraseResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text KeyPhraseExtraction task result. + public partial class AnalyzeTextKeyPhraseResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The list of Key phrase extraction results. + /// is null. + internal AnalyzeTextKeyPhraseResult(KeyPhraseResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.KeyPhraseExtractionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// The list of Key phrase extraction results. + internal AnalyzeTextKeyPhraseResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, KeyPhraseResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextKeyPhraseResult() + { + } + + /// The list of Key phrase extraction results. + public KeyPhraseResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextLanguageDetectionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextLanguageDetectionResult.Serialization.cs new file mode 100644 index 000000000000..cdc8dbd13b5a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextLanguageDetectionResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextLanguageDetectionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextLanguageDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextLanguageDetectionResult(document.RootElement, options); + } + + internal static AnalyzeTextLanguageDetectionResult DeserializeAnalyzeTextLanguageDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LanguageDetectionResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = LanguageDetectionResult.DeserializeLanguageDetectionResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextLanguageDetectionResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextLanguageDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextLanguageDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextLanguageDetectionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextLanguageDetectionResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextLanguageDetectionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextLanguageDetectionResult.cs new file mode 100644 index 000000000000..90b7fd6d8a46 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextLanguageDetectionResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the language detection task result for the request. + public partial class AnalyzeTextLanguageDetectionResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Contains the language detection results. + /// is null. + internal AnalyzeTextLanguageDetectionResult(LanguageDetectionResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.LanguageDetectionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Contains the language detection results. + internal AnalyzeTextLanguageDetectionResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, LanguageDetectionResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextLanguageDetectionResult() + { + } + + /// Contains the language detection results. + public LanguageDetectionResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationAction.Serialization.cs new file mode 100644 index 000000000000..ba2bbe1cfe48 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationAction.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextOperationAction))] + public partial class AnalyzeTextOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + + internal static AnalyzeTextOperationAction DeserializeAnalyzeTextOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AbstractiveSummarization": return AbstractiveSummarizationOperationAction.DeserializeAbstractiveSummarizationOperationAction(element, options); + case "CustomAbstractiveSummarization": return CustomAbstractiveSummarizationOperationAction.DeserializeCustomAbstractiveSummarizationOperationAction(element, options); + case "CustomEntityRecognition": return CustomEntitiesOperationAction.DeserializeCustomEntitiesOperationAction(element, options); + case "CustomHealthcare": return CustomHealthcareOperationAction.DeserializeCustomHealthcareOperationAction(element, options); + case "CustomMultiLabelClassification": return CustomMultiLabelClassificationOperationAction.DeserializeCustomMultiLabelClassificationOperationAction(element, options); + case "CustomSentimentAnalysis": return CustomSentimentAnalysisOperationAction.DeserializeCustomSentimentAnalysisOperationAction(element, options); + case "CustomSingleLabelClassification": return CustomSingleLabelClassificationOperationAction.DeserializeCustomSingleLabelClassificationOperationAction(element, options); + case "EntityLinking": return EntityLinkingOperationAction.DeserializeEntityLinkingOperationAction(element, options); + case "EntityRecognition": return EntitiesOperationAction.DeserializeEntitiesOperationAction(element, options); + case "ExtractiveSummarization": return ExtractiveSummarizationOperationAction.DeserializeExtractiveSummarizationOperationAction(element, options); + case "Healthcare": return HealthcareOperationAction.DeserializeHealthcareOperationAction(element, options); + case "KeyPhraseExtraction": return KeyPhraseOperationAction.DeserializeKeyPhraseOperationAction(element, options); + case "PiiEntityRecognition": return PiiOperationAction.DeserializePiiOperationAction(element, options); + case "SentimentAnalysis": return SentimentAnalysisOperationAction.DeserializeSentimentAnalysisOperationAction(element, options); + } + } + return UnknownAnalyzeTextOperationAction.DeserializeUnknownAnalyzeTextOperationAction(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationAction(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationAction.cs new file mode 100644 index 000000000000..6e1be87da3a2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationAction.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// The long running task to be performed by the service on the input documents. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public abstract partial class AnalyzeTextOperationAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AnalyzeTextOperationAction() + { + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData) + { + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// task name. + public string Name { get; set; } + /// The kind of task to perform. + internal AnalyzeTextOperationActionKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationActionKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationActionKind.cs new file mode 100644 index 000000000000..85f656e28396 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationActionKind.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The kind of the long running analyze text tasks supported. + internal readonly partial struct AnalyzeTextOperationActionKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextOperationActionKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisValue = "SentimentAnalysis"; + private const string EntityRecognitionValue = "EntityRecognition"; + private const string PiiEntityRecognitionValue = "PiiEntityRecognition"; + private const string KeyPhraseExtractionValue = "KeyPhraseExtraction"; + private const string EntityLinkingValue = "EntityLinking"; + private const string HealthcareValue = "Healthcare"; + private const string CustomEntityRecognitionValue = "CustomEntityRecognition"; + private const string CustomSingleLabelClassificationValue = "CustomSingleLabelClassification"; + private const string CustomMultiLabelClassificationValue = "CustomMultiLabelClassification"; + private const string ExtractiveSummarizationValue = "ExtractiveSummarization"; + private const string AbstractiveSummarizationValue = "AbstractiveSummarization"; + private const string CustomHealthcareValue = "CustomHealthcare"; + private const string CustomSentimentAnalysisValue = "CustomSentimentAnalysis"; + private const string CustomAbstractiveSummarizationValue = "CustomAbstractiveSummarization"; + + /// Sentiment analysis task. + public static AnalyzeTextOperationActionKind SentimentAnalysis { get; } = new AnalyzeTextOperationActionKind(SentimentAnalysisValue); + /// Entity recognition task. + public static AnalyzeTextOperationActionKind EntityRecognition { get; } = new AnalyzeTextOperationActionKind(EntityRecognitionValue); + /// PII entity recognition task. + public static AnalyzeTextOperationActionKind PiiEntityRecognition { get; } = new AnalyzeTextOperationActionKind(PiiEntityRecognitionValue); + /// Key phrase extraction task. + public static AnalyzeTextOperationActionKind KeyPhraseExtraction { get; } = new AnalyzeTextOperationActionKind(KeyPhraseExtractionValue); + /// Entity linking task. + public static AnalyzeTextOperationActionKind EntityLinking { get; } = new AnalyzeTextOperationActionKind(EntityLinkingValue); + /// Healthcare task. + public static AnalyzeTextOperationActionKind Healthcare { get; } = new AnalyzeTextOperationActionKind(HealthcareValue); + /// Custom entity recognition task. + public static AnalyzeTextOperationActionKind CustomEntityRecognition { get; } = new AnalyzeTextOperationActionKind(CustomEntityRecognitionValue); + /// Custom single label classification task. + public static AnalyzeTextOperationActionKind CustomSingleLabelClassification { get; } = new AnalyzeTextOperationActionKind(CustomSingleLabelClassificationValue); + /// Custom multi label classification task. + public static AnalyzeTextOperationActionKind CustomMultiLabelClassification { get; } = new AnalyzeTextOperationActionKind(CustomMultiLabelClassificationValue); + /// Extractive summarization task. + public static AnalyzeTextOperationActionKind ExtractiveSummarization { get; } = new AnalyzeTextOperationActionKind(ExtractiveSummarizationValue); + /// Abstractive summarization task. + public static AnalyzeTextOperationActionKind AbstractiveSummarization { get; } = new AnalyzeTextOperationActionKind(AbstractiveSummarizationValue); + /// Custom healthcare task. + public static AnalyzeTextOperationActionKind CustomHealthcare { get; } = new AnalyzeTextOperationActionKind(CustomHealthcareValue); + /// Custom sentiment analysis task. + public static AnalyzeTextOperationActionKind CustomSentimentAnalysis { get; } = new AnalyzeTextOperationActionKind(CustomSentimentAnalysisValue); + /// Custom abstractive summarization task. + public static AnalyzeTextOperationActionKind CustomAbstractiveSummarization { get; } = new AnalyzeTextOperationActionKind(CustomAbstractiveSummarizationValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextOperationActionKind left, AnalyzeTextOperationActionKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextOperationActionKind left, AnalyzeTextOperationActionKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeTextOperationActionKind(string value) => new AnalyzeTextOperationActionKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextOperationActionKind other && Equals(other); + /// + public bool Equals(AnalyzeTextOperationActionKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResult.Serialization.cs new file mode 100644 index 000000000000..0a1a9c16e038 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResult.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextOperationResult))] + public partial class AnalyzeTextOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + + internal static AnalyzeTextOperationResult DeserializeAnalyzeTextOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AbstractiveSummarizationLROResults": return AbstractiveSummarizationOperationResult.DeserializeAbstractiveSummarizationOperationResult(element, options); + case "CustomAbstractiveSummarizationLROResults": return CustomAbstractiveSummarizationOperationResult.DeserializeCustomAbstractiveSummarizationOperationResult(element, options); + case "CustomEntityRecognitionLROResults": return CustomEntityRecognitionOperationResult.DeserializeCustomEntityRecognitionOperationResult(element, options); + case "CustomHealthcareLROResults": return CustomHealthcareOperationResult.DeserializeCustomHealthcareOperationResult(element, options); + case "CustomMultiLabelClassificationLROResults": return CustomMultiLabelClassificationOperationResult.DeserializeCustomMultiLabelClassificationOperationResult(element, options); + case "CustomSentimentAnalysisLROResults": return CustomSentimentAnalysisOperationResult.DeserializeCustomSentimentAnalysisOperationResult(element, options); + case "CustomSingleLabelClassificationLROResults": return CustomSingleLabelClassificationOperationResult.DeserializeCustomSingleLabelClassificationOperationResult(element, options); + case "EntityLinkingLROResults": return EntityLinkingOperationResult.DeserializeEntityLinkingOperationResult(element, options); + case "EntityRecognitionLROResults": return EntityRecognitionOperationResult.DeserializeEntityRecognitionOperationResult(element, options); + case "ExtractiveSummarizationLROResults": return ExtractiveSummarizationOperationResult.DeserializeExtractiveSummarizationOperationResult(element, options); + case "HealthcareLROResults": return HealthcareOperationResult.DeserializeHealthcareOperationResult(element, options); + case "KeyPhraseExtractionLROResults": return KeyPhraseExtractionOperationResult.DeserializeKeyPhraseExtractionOperationResult(element, options); + case "PiiEntityRecognitionLROResults": return PiiEntityRecognitionOperationResult.DeserializePiiEntityRecognitionOperationResult(element, options); + case "SentimentAnalysisLROResults": return SentimentOperationResult.DeserializeSentimentOperationResult(element, options); + } + } + return UnknownAnalyzeTextOperationResult.DeserializeUnknownAnalyzeTextOperationResult(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResult.cs new file mode 100644 index 000000000000..260c0b8689a9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResult.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// Contains the AnalyzeText long running operation result object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public abstract partial class AnalyzeTextOperationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + protected AnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status) + { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData) + { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextOperationResult() + { + } + + /// The last updated time in UTC for the task. + public DateTimeOffset LastUpdateDateTime { get; } + /// The status of the task at the mentioned last update time. + public TextActionState Status { get; } + /// task name. + public string Name { get; } + /// Kind of the task. + internal AnalyzeTextOperationResultsKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResultsKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResultsKind.cs new file mode 100644 index 000000000000..7af2d7fe0ee2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationResultsKind.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The kind of the response object returned by the analyze-text long running task. + internal readonly partial struct AnalyzeTextOperationResultsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextOperationResultsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisOperationResultsValue = "SentimentAnalysisLROResults"; + private const string EntityRecognitionOperationResultsValue = "EntityRecognitionLROResults"; + private const string PiiEntityRecognitionOperationResultsValue = "PiiEntityRecognitionLROResults"; + private const string KeyPhraseExtractionOperationResultsValue = "KeyPhraseExtractionLROResults"; + private const string EntityLinkingOperationResultsValue = "EntityLinkingLROResults"; + private const string HealthcareOperationResultsValue = "HealthcareLROResults"; + private const string CustomEntityRecognitionOperationResultsValue = "CustomEntityRecognitionLROResults"; + private const string CustomSingleLabelClassificationOperationResultsValue = "CustomSingleLabelClassificationLROResults"; + private const string CustomMultiLabelClassificationOperationResultsValue = "CustomMultiLabelClassificationLROResults"; + private const string ExtractiveSummarizationOperationResultsValue = "ExtractiveSummarizationLROResults"; + private const string AbstractiveSummarizationOperationResultsValue = "AbstractiveSummarizationLROResults"; + private const string CustomHealthcareOperationResultsValue = "CustomHealthcareLROResults"; + private const string CustomSentimentAnalysisOperationResultsValue = "CustomSentimentAnalysisLROResults"; + private const string CustomAbstractiveSummarizationOperationResultsValue = "CustomAbstractiveSummarizationLROResults"; + + /// Sentiment analysis LRO results. + public static AnalyzeTextOperationResultsKind SentimentAnalysisOperationResults { get; } = new AnalyzeTextOperationResultsKind(SentimentAnalysisOperationResultsValue); + /// Entity recognition LRO results. + public static AnalyzeTextOperationResultsKind EntityRecognitionOperationResults { get; } = new AnalyzeTextOperationResultsKind(EntityRecognitionOperationResultsValue); + /// PII entity recognition LRO results. + public static AnalyzeTextOperationResultsKind PiiEntityRecognitionOperationResults { get; } = new AnalyzeTextOperationResultsKind(PiiEntityRecognitionOperationResultsValue); + /// Key phrase extraction LRO results. + public static AnalyzeTextOperationResultsKind KeyPhraseExtractionOperationResults { get; } = new AnalyzeTextOperationResultsKind(KeyPhraseExtractionOperationResultsValue); + /// Entity linking LRO results. + public static AnalyzeTextOperationResultsKind EntityLinkingOperationResults { get; } = new AnalyzeTextOperationResultsKind(EntityLinkingOperationResultsValue); + /// Healthcare LRO results. + public static AnalyzeTextOperationResultsKind HealthcareOperationResults { get; } = new AnalyzeTextOperationResultsKind(HealthcareOperationResultsValue); + /// Custom entity recognition LRO results. + public static AnalyzeTextOperationResultsKind CustomEntityRecognitionOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomEntityRecognitionOperationResultsValue); + /// Custom single label classification LRO results. + public static AnalyzeTextOperationResultsKind CustomSingleLabelClassificationOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomSingleLabelClassificationOperationResultsValue); + /// Custom multi label classification LRO results. + public static AnalyzeTextOperationResultsKind CustomMultiLabelClassificationOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomMultiLabelClassificationOperationResultsValue); + /// Extractive summarization LRO results. + public static AnalyzeTextOperationResultsKind ExtractiveSummarizationOperationResults { get; } = new AnalyzeTextOperationResultsKind(ExtractiveSummarizationOperationResultsValue); + /// Abstractive summarization LRO results. + public static AnalyzeTextOperationResultsKind AbstractiveSummarizationOperationResults { get; } = new AnalyzeTextOperationResultsKind(AbstractiveSummarizationOperationResultsValue); + /// Custom healthcare LRO results. + public static AnalyzeTextOperationResultsKind CustomHealthcareOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomHealthcareOperationResultsValue); + /// Custom sentiment analysis LRO results. + public static AnalyzeTextOperationResultsKind CustomSentimentAnalysisOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomSentimentAnalysisOperationResultsValue); + /// Custom abstractive summarization LRO results. + public static AnalyzeTextOperationResultsKind CustomAbstractiveSummarizationOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomAbstractiveSummarizationOperationResultsValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextOperationResultsKind left, AnalyzeTextOperationResultsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextOperationResultsKind left, AnalyzeTextOperationResultsKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeTextOperationResultsKind(string value) => new AnalyzeTextOperationResultsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextOperationResultsKind other && Equals(other); + /// + public bool Equals(AnalyzeTextOperationResultsKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationState.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationState.Serialization.cs new file mode 100644 index 000000000000..2e1fd65de15a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationState.Serialization.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextOperationState : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedAt, "O"); + if (Optional.IsDefined(ExpiresOn)) + { + writer.WritePropertyName("expirationDateTime"u8); + writer.WriteStringValue(ExpiresOn.Value, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + } + writer.WritePropertyName("lastUpdatedDateTime"u8); + writer.WriteStringValue(LastUpdatedAt, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("tasks"u8); + writer.WriteObjectValue(Actions, options); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextOperationState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationState(document.RootElement, options); + } + + internal static AnalyzeTextOperationState DeserializeAnalyzeTextOperationState(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + DateTimeOffset createdDateTime = default; + DateTimeOffset? expirationDateTime = default; + Guid jobId = default; + DateTimeOffset lastUpdatedDateTime = default; + TextActionState status = default; + IReadOnlyList errors = default; + string nextLink = default; + TextActions tasks = default; + RequestStatistics statistics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("expirationDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("jobId"u8)) + { + jobId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("lastUpdatedDateTime"u8)) + { + lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeTextError.DeserializeAnalyzeTextError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("tasks"u8)) + { + tasks = TextActions.DeserializeTextActions(property.Value, options); + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextOperationState( + displayName, + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors ?? new ChangeTrackingList(), + nextLink, + tasks, + statistics, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextOperationState FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationState(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationState.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationState.cs new file mode 100644 index 000000000000..703f08196bd0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextOperationState.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The object containing the analyze job LRO job state. + public partial class AnalyzeTextOperationState + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Date and time job created. + /// last updated date and time. + /// status. + /// List of tasks. + /// is null. + internal AnalyzeTextOperationState(DateTimeOffset createdAt, DateTimeOffset lastUpdatedAt, TextActionState status, TextActions actions) + { + Argument.AssertNotNull(actions, nameof(actions)); + + CreatedAt = createdAt; + LastUpdatedAt = lastUpdatedAt; + Status = status; + Errors = new ChangeTrackingList(); + Actions = actions; + } + + /// Initializes a new instance of . + /// display name. + /// Date and time job created. + /// Date and time job expires. + /// job ID. + /// last updated date and time. + /// status. + /// errors. + /// next link. + /// List of tasks. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationState(string displayName, DateTimeOffset createdAt, DateTimeOffset? expiresOn, Guid jobId, DateTimeOffset lastUpdatedAt, TextActionState status, IReadOnlyList errors, string nextLink, TextActions actions, RequestStatistics statistics, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + CreatedAt = createdAt; + ExpiresOn = expiresOn; + JobId = jobId; + LastUpdatedAt = lastUpdatedAt; + Status = status; + Errors = errors; + NextLink = nextLink; + Actions = actions; + Statistics = statistics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextOperationState() + { + } + + /// display name. + public string DisplayName { get; } + /// Date and time job created. + public DateTimeOffset CreatedAt { get; } + /// Date and time job expires. + public DateTimeOffset? ExpiresOn { get; } + /// job ID. + public Guid JobId { get; } + /// last updated date and time. + public DateTimeOffset LastUpdatedAt { get; } + /// status. + public TextActionState Status { get; } + /// errors. + public IReadOnlyList Errors { get; } + /// next link. + public string NextLink { get; } + /// List of tasks. + public TextActions Actions { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextPiiResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextPiiResult.Serialization.cs new file mode 100644 index 000000000000..b6e64dc5b023 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextPiiResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextPiiResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextPiiResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextPiiResult(document.RootElement, options); + } + + internal static AnalyzeTextPiiResult DeserializeAnalyzeTextPiiResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = PiiResult.DeserializePiiResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextPiiResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextPiiResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextPiiResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextPiiResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextPiiResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextPiiResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextPiiResult.cs new file mode 100644 index 000000000000..fa875b34da8f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextPiiResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text PIIEntityRecognition LRO task. + public partial class AnalyzeTextPiiResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The list of pii results. + /// is null. + internal AnalyzeTextPiiResult(PiiResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.PiiEntityRecognitionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// The list of pii results. + internal AnalyzeTextPiiResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, PiiResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextPiiResult() + { + } + + /// The list of pii results. + public PiiResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResult.Serialization.cs new file mode 100644 index 000000000000..c9782bac5ffe --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResult.Serialization.cs @@ -0,0 +1,139 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextResult))] + public partial class AnalyzeTextResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + + internal static AnalyzeTextResult DeserializeAnalyzeTextResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DynamicClassificationResults": return AnalyzeTextDynamicClassificationResult.DeserializeAnalyzeTextDynamicClassificationResult(element, options); + case "EntityLinkingResults": return AnalyzeTextEntityLinkingResult.DeserializeAnalyzeTextEntityLinkingResult(element, options); + case "EntityRecognitionResults": return AnalyzeTextEntitiesResult.DeserializeAnalyzeTextEntitiesResult(element, options); + case "KeyPhraseExtractionResults": return AnalyzeTextKeyPhraseResult.DeserializeAnalyzeTextKeyPhraseResult(element, options); + case "LanguageDetectionResults": return AnalyzeTextLanguageDetectionResult.DeserializeAnalyzeTextLanguageDetectionResult(element, options); + case "PiiEntityRecognitionResults": return AnalyzeTextPiiResult.DeserializeAnalyzeTextPiiResult(element, options); + case "SentimentAnalysisResults": return AnalyzeTextSentimentResult.DeserializeAnalyzeTextSentimentResult(element, options); + } + } + return UnknownAnalyzeTextResult.DeserializeUnknownAnalyzeTextResult(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResult.cs new file mode 100644 index 000000000000..9820a5ccc0f0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResult.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// The result object for the analyze task. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public abstract partial class AnalyzeTextResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AnalyzeTextResult() + { + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The kind of task result. + internal AnalyzeTextResultsKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResultsKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResultsKind.cs new file mode 100644 index 000000000000..e523ba352fd5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextResultsKind.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The kind of the response object returned by the analyze-text task. + internal readonly partial struct AnalyzeTextResultsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextResultsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisResultsValue = "SentimentAnalysisResults"; + private const string EntityRecognitionResultsValue = "EntityRecognitionResults"; + private const string PiiEntityRecognitionResultsValue = "PiiEntityRecognitionResults"; + private const string KeyPhraseExtractionResultsValue = "KeyPhraseExtractionResults"; + private const string LanguageDetectionResultsValue = "LanguageDetectionResults"; + private const string EntityLinkingResultsValue = "EntityLinkingResults"; + private const string DynamicClassificationResultsValue = "DynamicClassificationResults"; + + /// Sentiment analysis results. + public static AnalyzeTextResultsKind SentimentAnalysisResults { get; } = new AnalyzeTextResultsKind(SentimentAnalysisResultsValue); + /// Entity recognition results. + public static AnalyzeTextResultsKind EntityRecognitionResults { get; } = new AnalyzeTextResultsKind(EntityRecognitionResultsValue); + /// PII entity recognition results. + public static AnalyzeTextResultsKind PiiEntityRecognitionResults { get; } = new AnalyzeTextResultsKind(PiiEntityRecognitionResultsValue); + /// Key phrase extraction results. + public static AnalyzeTextResultsKind KeyPhraseExtractionResults { get; } = new AnalyzeTextResultsKind(KeyPhraseExtractionResultsValue); + /// Language detection results. + public static AnalyzeTextResultsKind LanguageDetectionResults { get; } = new AnalyzeTextResultsKind(LanguageDetectionResultsValue); + /// Entity linking results. + public static AnalyzeTextResultsKind EntityLinkingResults { get; } = new AnalyzeTextResultsKind(EntityLinkingResultsValue); + /// Dynamic classification results. + public static AnalyzeTextResultsKind DynamicClassificationResults { get; } = new AnalyzeTextResultsKind(DynamicClassificationResultsValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextResultsKind left, AnalyzeTextResultsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextResultsKind left, AnalyzeTextResultsKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeTextResultsKind(string value) => new AnalyzeTextResultsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextResultsKind other && Equals(other); + /// + public bool Equals(AnalyzeTextResultsKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSentimentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSentimentResult.Serialization.cs new file mode 100644 index 000000000000..346fca384eeb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSentimentResult.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AnalyzeTextSentimentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + AnalyzeTextSentimentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextSentimentResult(document.RootElement, options); + } + + internal static AnalyzeTextSentimentResult DeserializeAnalyzeTextSentimentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SentimentResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = SentimentResult.DeserializeSentimentResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextSentimentResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextSentimentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextSentimentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextSentimentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextSentimentResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSentimentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSentimentResult.cs new file mode 100644 index 000000000000..83c8531e570f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSentimentResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text SentimentAnalysis LRO task result. + public partial class AnalyzeTextSentimentResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The sentiment analysis results. + /// is null. + internal AnalyzeTextSentimentResult(SentimentResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.SentimentAnalysisResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// The sentiment analysis results. + internal AnalyzeTextSentimentResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, SentimentResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextSentimentResult() + { + } + + /// The sentiment analysis results. + public SentimentResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSubmitJobRequest.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSubmitJobRequest.Serialization.cs new file mode 100644 index 000000000000..d00e82d5fab5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSubmitJobRequest.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class AnalyzeTextSubmitJobRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextSubmitJobRequest)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + writer.WritePropertyName("tasks"u8); + writer.WriteStartArray(); + foreach (var item in Actions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DefaultLanguage)) + { + writer.WritePropertyName("defaultLanguage"u8); + writer.WriteStringValue(DefaultLanguage); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AnalyzeTextSubmitJobRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextSubmitJobRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextSubmitJobRequest(document.RootElement, options); + } + + internal static AnalyzeTextSubmitJobRequest DeserializeAnalyzeTextSubmitJobRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + MultiLanguageTextInput analysisInput = default; + IReadOnlyList tasks = default; + string defaultLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("analysisInput"u8)) + { + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("tasks"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeTextOperationAction.DeserializeAnalyzeTextOperationAction(item, options)); + } + tasks = array; + continue; + } + if (property.NameEquals("defaultLanguage"u8)) + { + defaultLanguage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextSubmitJobRequest(displayName, analysisInput, tasks, defaultLanguage, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextSubmitJobRequest)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextSubmitJobRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextSubmitJobRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextSubmitJobRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextSubmitJobRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextSubmitJobRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSubmitJobRequest.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSubmitJobRequest.cs new file mode 100644 index 000000000000..52e82a53852c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AnalyzeTextSubmitJobRequest.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// The AnalyzeTextSubmitJobRequest. + internal partial class AnalyzeTextSubmitJobRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Contains the input to be analyzed. + /// + /// List of tasks to be performed as part of the LRO. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// or is null. + internal AnalyzeTextSubmitJobRequest(MultiLanguageTextInput textInput, IEnumerable actions) + { + Argument.AssertNotNull(textInput, nameof(textInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + TextInput = textInput; + Actions = actions.ToList(); + } + + /// Initializes a new instance of . + /// Name for the task. + /// Contains the input to be analyzed. + /// + /// List of tasks to be performed as part of the LRO. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// Default language to use for records requesting automatic language detection. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextSubmitJobRequest(string displayName, MultiLanguageTextInput textInput, IReadOnlyList actions, string defaultLanguage, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + TextInput = textInput; + Actions = actions; + DefaultLanguage = defaultLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextSubmitJobRequest() + { + } + + /// Name for the task. + public string DisplayName { get; } + /// Contains the input to be analyzed. + public MultiLanguageTextInput TextInput { get; } + /// + /// List of tasks to be performed as part of the LRO. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public IReadOnlyList Actions { get; } + /// Default language to use for records requesting automatic language detection. + public string DefaultLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaMetadata.Serialization.cs new file mode 100644 index 000000000000..0bc77ea97341 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class AreaMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AreaMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + AreaMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AreaMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAreaMetadata(document.RootElement, options); + } + + internal static AreaMetadata DeserializeAreaMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + AreaUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new AreaUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AreaMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AreaMetadata)} does not support writing '{options.Format}' format."); + } + } + + AreaMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAreaMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AreaMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AreaMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAreaMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaMetadata.cs new file mode 100644 index 000000000000..b9cac2215c3a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Area entity Metadata model. + public partial class AreaMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for area. + internal AreaMetadata(double value, AreaUnit unit) + { + MetadataKind = MetadataKind.AreaMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for area. + internal AreaMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, AreaUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal AreaMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for area. + public AreaUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaUnit.cs new file mode 100644 index 000000000000..60ab0a4a1aba --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AreaUnit.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The area unit of measurement. + public readonly partial struct AreaUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AreaUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string SquareKilometerValue = "SquareKilometer"; + private const string SquareHectometerValue = "SquareHectometer"; + private const string SquareDecameterValue = "SquareDecameter"; + private const string SquareDecimeterValue = "SquareDecimeter"; + private const string SquareMeterValue = "SquareMeter"; + private const string SquareCentimeterValue = "SquareCentimeter"; + private const string SquareMillimeterValue = "SquareMillimeter"; + private const string SquareInchValue = "SquareInch"; + private const string SquareFootValue = "SquareFoot"; + private const string SquareMileValue = "SquareMile"; + private const string SquareYardValue = "SquareYard"; + private const string AcreValue = "Acre"; + + /// Unspecified area unit. + public static AreaUnit Unspecified { get; } = new AreaUnit(UnspecifiedValue); + /// Area unit in square kilometers. + public static AreaUnit SquareKilometer { get; } = new AreaUnit(SquareKilometerValue); + /// Area unit in square hectometers. + public static AreaUnit SquareHectometer { get; } = new AreaUnit(SquareHectometerValue); + /// Area unit in square decameters. + public static AreaUnit SquareDecameter { get; } = new AreaUnit(SquareDecameterValue); + /// Area unit in square decimeters. + public static AreaUnit SquareDecimeter { get; } = new AreaUnit(SquareDecimeterValue); + /// Area unit in square meters. + public static AreaUnit SquareMeter { get; } = new AreaUnit(SquareMeterValue); + /// Area unit in square centimeters. + public static AreaUnit SquareCentimeter { get; } = new AreaUnit(SquareCentimeterValue); + /// Area unit in square millimeters. + public static AreaUnit SquareMillimeter { get; } = new AreaUnit(SquareMillimeterValue); + /// Area unit in square inches. + public static AreaUnit SquareInch { get; } = new AreaUnit(SquareInchValue); + /// Area unit in square feet. + public static AreaUnit SquareFoot { get; } = new AreaUnit(SquareFootValue); + /// Area unit in square miles. + public static AreaUnit SquareMile { get; } = new AreaUnit(SquareMileValue); + /// Area unit in square yards. + public static AreaUnit SquareYard { get; } = new AreaUnit(SquareYardValue); + /// Area unit in acres. + public static AreaUnit Acre { get; } = new AreaUnit(AcreValue); + /// Determines if two values are the same. + public static bool operator ==(AreaUnit left, AreaUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AreaUnit left, AreaUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AreaUnit(string value) => new AreaUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AreaUnit other && Equals(other); + /// + public bool Equals(AreaUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/BaseMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/BaseMetadata.Serialization.cs new file mode 100644 index 000000000000..f5fd1b66d3ed --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/BaseMetadata.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownBaseMetadata))] + public partial class BaseMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BaseMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseMetadata(document.RootElement, options); + } + + internal static BaseMetadata DeserializeBaseMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("metadataKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AgeMetadata": return AgeMetadata.DeserializeAgeMetadata(element, options); + case "AreaMetadata": return AreaMetadata.DeserializeAreaMetadata(element, options); + case "CurrencyMetadata": return CurrencyMetadata.DeserializeCurrencyMetadata(element, options); + case "DateMetadata": return DateMetadata.DeserializeDateMetadata(element, options); + case "DateTimeMetadata": return DateTimeMetadata.DeserializeDateTimeMetadata(element, options); + case "InformationMetadata": return InformationMetadata.DeserializeInformationMetadata(element, options); + case "LengthMetadata": return LengthMetadata.DeserializeLengthMetadata(element, options); + case "NumberMetadata": return NumberMetadata.DeserializeNumberMetadata(element, options); + case "NumericRangeMetadata": return NumericRangeMetadata.DeserializeNumericRangeMetadata(element, options); + case "OrdinalMetadata": return OrdinalMetadata.DeserializeOrdinalMetadata(element, options); + case "SpeedMetadata": return SpeedMetadata.DeserializeSpeedMetadata(element, options); + case "TemperatureMetadata": return TemperatureMetadata.DeserializeTemperatureMetadata(element, options); + case "TemporalSetMetadata": return TemporalSetMetadata.DeserializeTemporalSetMetadata(element, options); + case "TemporalSpanMetadata": return TemporalSpanMetadata.DeserializeTemporalSpanMetadata(element, options); + case "TimeMetadata": return TimeMetadata.DeserializeTimeMetadata(element, options); + case "VolumeMetadata": return VolumeMetadata.DeserializeVolumeMetadata(element, options); + case "WeightMetadata": return WeightMetadata.DeserializeWeightMetadata(element, options); + } + } + return UnknownBaseMetadata.DeserializeUnknownBaseMetadata(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{options.Format}' format."); + } + } + + BaseMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaseMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static BaseMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBaseMetadata(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/BaseMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/BaseMetadata.cs new file mode 100644 index 000000000000..096136e572f3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/BaseMetadata.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// The abstract base class for entity Metadata. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + public abstract partial class BaseMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected BaseMetadata() + { + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + internal BaseMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData) + { + MetadataKind = metadataKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity Metadata object kind. + internal MetadataKind MetadataKind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationActionResult.Serialization.cs new file mode 100644 index 000000000000..4fbc23be3368 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationActionResult.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ClassificationActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("class"u8); + writer.WriteStartArray(); + foreach (var item in Class) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ClassificationActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationActionResult(document.RootElement, options); + } + + internal static ClassificationActionResult DeserializeClassificationActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList @class = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("class"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationResult.DeserializeClassificationResult(item, options)); + } + @class = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClassificationActionResult( + id, + warnings, + statistics, + @class, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ClassificationActionResult)} does not support writing '{options.Format}' format."); + } + } + + ClassificationActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeClassificationActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClassificationActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ClassificationActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeClassificationActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationActionResult.cs new file mode 100644 index 000000000000..acf101f84624 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationActionResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the classification doc result for the task with detected language. + public partial class ClassificationActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Contains the classification doc results for all docs. + /// , or is null. + internal ClassificationActionResult(string id, IEnumerable warnings, IEnumerable @class) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(@class, nameof(@class)); + + Id = id; + Warnings = warnings.ToList(); + Class = @class.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Contains the classification doc results for all docs. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal ClassificationActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList @class, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Class = @class; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClassificationActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Contains the classification doc results for all docs. + public IReadOnlyList Class { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationResult.Serialization.cs new file mode 100644 index 000000000000..8ba8966c1dd0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationResult.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ClassificationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ClassificationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationResult(document.RootElement, options); + } + + internal static ClassificationResult DeserializeClassificationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string category = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClassificationResult(category, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ClassificationResult)} does not support writing '{options.Format}' format."); + } + } + + ClassificationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeClassificationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClassificationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ClassificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeClassificationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationResult.cs new file mode 100644 index 000000000000..7091387c0442 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationResult.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the classification result. + public partial class ClassificationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Classification type. + /// Confidence score between 0 and 1 of the recognized class. + /// is null. + internal ClassificationResult(string category, double confidenceScore) + { + Argument.AssertNotNull(category, nameof(category)); + + Category = category; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// Classification type. + /// Confidence score between 0 and 1 of the recognized class. + /// Keeps track of any properties unknown to the library. + internal ClassificationResult(string category, double confidenceScore, IDictionary serializedAdditionalRawData) + { + Category = category; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClassificationResult() + { + } + + /// Classification type. + public string Category { get; } + /// Confidence score between 0 and 1 of the recognized class. + public double ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationType.cs new file mode 100644 index 000000000000..f61a5f789708 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ClassificationType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Specifies either one or multiple categories per document. Defaults to multi classification which may return more than one class for each document. + public readonly partial struct ClassificationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClassificationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MultiValue = "Multi"; + private const string SingleValue = "Single"; + + /// Multi selection. + public static ClassificationType Multi { get; } = new ClassificationType(MultiValue); + /// Single selection. + public static ClassificationType Single { get; } = new ClassificationType(SingleValue); + /// Determines if two values are the same. + public static bool operator ==(ClassificationType left, ClassificationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClassificationType left, ClassificationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ClassificationType(string value) => new ClassificationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClassificationType other && Equals(other); + /// + public bool Equals(ClassificationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CurrencyMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CurrencyMetadata.Serialization.cs new file mode 100644 index 000000000000..65c9756d3594 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CurrencyMetadata.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CurrencyMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + if (Optional.IsDefined(Iso4217)) + { + writer.WritePropertyName("iso4217"u8); + writer.WriteStringValue(Iso4217); + } + } + + CurrencyMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCurrencyMetadata(document.RootElement, options); + } + + internal static CurrencyMetadata DeserializeCurrencyMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + string unit = default; + string iso4217 = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("iso4217"u8)) + { + iso4217 = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CurrencyMetadata(metadataKind, serializedAdditionalRawData, value, unit, iso4217); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support writing '{options.Format}' format."); + } + } + + CurrencyMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCurrencyMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CurrencyMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCurrencyMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CurrencyMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CurrencyMetadata.cs new file mode 100644 index 000000000000..8aefdb57793b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CurrencyMetadata.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Currency ) entity Metadata model. + public partial class CurrencyMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Currency unit. + /// is null. + internal CurrencyMetadata(double value, string unit) + { + Argument.AssertNotNull(unit, nameof(unit)); + + MetadataKind = MetadataKind.CurrencyMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Currency unit. + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + internal CurrencyMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, string unit, string iso4217) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + Iso4217 = iso4217; + } + + /// Initializes a new instance of for deserialization. + internal CurrencyMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Currency unit. + public string Unit { get; } + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + public string Iso4217 { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 000000000000..a4b6b8ff1942 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationActionContent.Serialization.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomAbstractiveSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SentenceCount)) + { + writer.WritePropertyName("sentenceCount"u8); + writer.WriteNumberValue(SentenceCount.Value); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(SummaryLength)) + { + writer.WritePropertyName("summaryLength"u8); + writer.WriteStringValue(SummaryLength.Value.ToString()); + } + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomAbstractiveSummarizationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationActionContent(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationActionContent DeserializeCustomAbstractiveSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? sentenceCount = default; + StringIndexType? stringIndexType = default; + SummaryLengthBucket? summaryLength = default; + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sentenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentenceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("summaryLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + summaryLength = new SummaryLengthBucket(property.Value.GetString()); + continue; + } + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationActionContent( + sentenceCount, + stringIndexType, + summaryLength, + loggingOptOut, + projectName, + deploymentName, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomAbstractiveSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationActionContent.cs new file mode 100644 index 000000000000..25897ca10c5c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationActionContent.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for the Custom Abstractive Summarization task. + public partial class CustomAbstractiveSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomAbstractiveSummarizationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomAbstractiveSummarizationActionContent(int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, bool? loggingOptOut, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationActionContent() + { + } + + /// Controls the approximate number of sentences in the output summaries. + public int? SentenceCount { get; set; } + /// String index type. + public StringIndexType? StringIndexType { get; set; } + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + public SummaryLengthBucket? SummaryLength { get; set; } + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 000000000000..f82979a4eaca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationAction.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomAbstractiveSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + + CustomAbstractiveSummarizationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationOperationAction(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationOperationAction DeserializeCustomAbstractiveSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomAbstractiveSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + parameters = CustomAbstractiveSummarizationActionContent.DeserializeCustomAbstractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomAbstractiveSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationAction.cs new file mode 100644 index 000000000000..65e6e32a2312 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationAction.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the task definition for an Custom Abstractive Summarization task. + public partial class CustomAbstractiveSummarizationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + /// Parameters for the Custom Abstractive Summarization task. + /// is null. + public CustomAbstractiveSummarizationOperationAction(CustomAbstractiveSummarizationActionContent actionContent) + { + Argument.AssertNotNull(actionContent, nameof(actionContent)); + + Kind = AnalyzeTextOperationActionKind.CustomAbstractiveSummarization; + ActionContent = actionContent; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Custom Abstractive Summarization task. + internal CustomAbstractiveSummarizationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomAbstractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationOperationAction() + { + } + + /// Parameters for the Custom Abstractive Summarization task. + public CustomAbstractiveSummarizationActionContent ActionContent { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 000000000000..a174b02dac83 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomAbstractiveSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + CustomAbstractiveSummarizationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationOperationResult(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationOperationResult DeserializeCustomAbstractiveSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomAbstractiveSummarizationResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomAbstractiveSummarizationResult.DeserializeCustomAbstractiveSummarizationResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomAbstractiveSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationResult.cs new file mode 100644 index 000000000000..6e882c50176b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the results for an Custom Abstractive Summarization task. + public partial class CustomAbstractiveSummarizationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal CustomAbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomAbstractiveSummarizationResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomAbstractiveSummarizationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal CustomAbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomAbstractiveSummarizationResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public CustomAbstractiveSummarizationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationResult.Serialization.cs new file mode 100644 index 000000000000..5d77cb712f9f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationResult.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomAbstractiveSummarizationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomAbstractiveSummarizationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationResult(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationResult DeserializeCustomAbstractiveSummarizationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList documents = default; + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummaryActionResult.DeserializeAbstractiveSummaryActionResult(item, options)); + } + documents = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationResult( + documents, + errors, + statistics, + projectName, + deploymentName, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomAbstractiveSummarizationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationResult.cs new file mode 100644 index 000000000000..ecd4baccb173 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomAbstractiveSummarizationResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// An object representing the custom summarization results of each document. + public partial class CustomAbstractiveSummarizationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Response by document. + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// , , or is null. + internal CustomAbstractiveSummarizationResult(IEnumerable documents, IEnumerable errors, string projectName, string deploymentName) + { + Argument.AssertNotNull(documents, nameof(documents)); + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + Documents = documents.ToList(); + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// Response by document. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomAbstractiveSummarizationResult(IReadOnlyList documents, IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + Documents = documents; + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationResult() + { + } + + /// Response by document. + public IReadOnlyList Documents { get; } + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionContent.Serialization.cs new file mode 100644 index 000000000000..751441e6a376 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionContent.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomEntitiesActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomEntitiesActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntitiesActionContent(document.RootElement, options); + } + + internal static CustomEntitiesActionContent DeserializeCustomEntitiesActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntitiesActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomEntitiesActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntitiesActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomEntitiesActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntitiesActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionContent.cs new file mode 100644 index 000000000000..f01e9663ae59 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionContent.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Custom Entities task. + public partial class CustomEntitiesActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomEntitiesActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// Keeps track of any properties unknown to the library. + internal CustomEntitiesActionContent(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomEntitiesActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionResult.Serialization.cs new file mode 100644 index 000000000000..663ec166c845 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionResult.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomEntitiesActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomEntitiesActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntitiesActionResult(document.RootElement, options); + } + + internal static CustomEntitiesActionResult DeserializeCustomEntitiesActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityActionResult.DeserializeEntityActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntitiesActionResult( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntitiesActionResult)} does not support writing '{options.Format}' format."); + } + } + + CustomEntitiesActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntitiesActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntitiesActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomEntitiesActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntitiesActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionResult.cs new file mode 100644 index 000000000000..f4c987c06704 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesActionResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the list of detected custom entities result for the documents along with detected language. + public partial class CustomEntitiesActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Enumeration of the document results with detected language. + /// , , or is null. + internal CustomEntitiesActionResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Enumeration of the document results with detected language. + /// Keeps track of any properties unknown to the library. + internal CustomEntitiesActionResult(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomEntitiesActionResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Enumeration of the document results with detected language. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesOperationAction.Serialization.cs new file mode 100644 index 000000000000..9cfb3ff47ea4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomEntitiesOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + CustomEntitiesOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntitiesOperationAction(document.RootElement, options); + } + + internal static CustomEntitiesOperationAction DeserializeCustomEntitiesOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomEntitiesActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomEntitiesActionContent.DeserializeCustomEntitiesActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntitiesOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomEntitiesOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntitiesOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomEntitiesOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntitiesOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesOperationAction.cs new file mode 100644 index 000000000000..8cfec27544de --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntitiesOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom text LRO task. + public partial class CustomEntitiesOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomEntitiesOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomEntityRecognition; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// task parameters. + internal CustomEntitiesOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomEntitiesActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// task parameters. + public CustomEntitiesActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntityRecognitionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 000000000000..9e4dbbc79eec --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntityRecognitionOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomEntityRecognitionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + CustomEntityRecognitionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntityRecognitionOperationResult(document.RootElement, options); + } + + internal static CustomEntityRecognitionOperationResult DeserializeCustomEntityRecognitionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomEntitiesActionResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomEntitiesActionResult.DeserializeCustomEntitiesActionResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomEntityRecognitionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntityRecognitionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomEntityRecognitionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntityRecognitionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntityRecognitionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntityRecognitionOperationResult.cs new file mode 100644 index 000000000000..6507130692f4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomEntityRecognitionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom entity recognition job result. + public partial class CustomEntityRecognitionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// List of results. + /// is null. + internal CustomEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomEntitiesActionResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomEntityRecognitionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// List of results. + internal CustomEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomEntitiesActionResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomEntityRecognitionOperationResult() + { + } + + /// List of results. + public CustomEntitiesActionResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionContent.Serialization.cs new file mode 100644 index 000000000000..3e92247d7a2d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionContent.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomHealthcareActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomHealthcareActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareActionContent(document.RootElement, options); + } + + internal static CustomHealthcareActionContent DeserializeCustomHealthcareActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionContent.cs new file mode 100644 index 000000000000..e2d7f93f3c5f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionContent.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a custom Healthcare task. + public partial class CustomHealthcareActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomHealthcareActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareActionContent(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionResult.Serialization.cs new file mode 100644 index 000000000000..c426dc5dd63d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionResult.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomHealthcareActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("relations"u8); + writer.WriteStartArray(); + foreach (var item in Relations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomHealthcareActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareActionResult(document.RootElement, options); + } + + internal static CustomHealthcareActionResult DeserializeCustomHealthcareActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + IReadOnlyList relations = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomHealthcareEntity.DeserializeCustomHealthcareEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelation.DeserializeHealthcareRelation(item, options)); + } + relations = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareActionResult( + id, + warnings, + statistics, + entities, + relations, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareActionResult)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionResult.cs new file mode 100644 index 000000000000..6543bc91aace --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareActionResult.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the document custom healthcare results with detected language. + public partial class CustomHealthcareActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Healthcare entities. + /// Healthcare entity relations. + /// , , or is null. + internal CustomHealthcareActionResult(string id, IEnumerable warnings, IEnumerable entities, IEnumerable relations) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + Argument.AssertNotNull(relations, nameof(relations)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + Relations = relations.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, IReadOnlyList relations, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + Relations = relations; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Healthcare entities. + public IReadOnlyList Entities { get; } + /// Healthcare entity relations. + public IReadOnlyList Relations { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareEntity.Serialization.cs new file mode 100644 index 000000000000..9d796618c9c0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareEntity.Serialization.cs @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomHealthcareEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + if (Optional.IsDefined(Subcategory)) + { + writer.WritePropertyName("subcategory"u8); + writer.WriteStringValue(Subcategory); + } + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (Optional.IsDefined(Assertion)) + { + writer.WritePropertyName("assertion"u8); + writer.WriteObjectValue(Assertion, options); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Links)) + { + writer.WritePropertyName("links"u8); + writer.WriteStartArray(); + foreach (var item in Links) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(EntityComponentInformation)) + { + writer.WritePropertyName("entityComponentInformation"u8); + writer.WriteStartArray(); + foreach (var item in EntityComponentInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomHealthcareEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareEntity(document.RootElement, options); + } + + internal static CustomHealthcareEntity DeserializeCustomHealthcareEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + HealthcareEntityCategory category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + HealthcareAssertion assertion = default; + string name = default; + IReadOnlyList links = default; + IReadOnlyList entityComponentInformation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = new HealthcareEntityCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("assertion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + assertion = HealthcareAssertion.DeserializeHealthcareAssertion(property.Value, options); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("links"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntityLink.DeserializeHealthcareEntityLink(item, options)); + } + links = array; + continue; + } + if (property.NameEquals("entityComponentInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Language.Text.EntityComponentInformation.DeserializeEntityComponentInformation(item, options)); + } + entityComponentInformation = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links ?? new ChangeTrackingList(), + entityComponentInformation ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareEntity.cs new file mode 100644 index 000000000000..a3237f18d8e0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareEntity.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom healthcare entity. + public partial class CustomHealthcareEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// is null. + internal CustomHealthcareEntity(string text, HealthcareEntityCategory category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Links = new ChangeTrackingList(); + EntityComponentInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// + /// (Optional) Entity component information listing fired components of the extracted entity. This object only applies for custom healthcare. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareEntity(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareAssertion assertion, string name, IReadOnlyList links, IReadOnlyList entityComponentInformation, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Assertion = assertion; + Name = name; + Links = links; + EntityComponentInformation = entityComponentInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Healthcare Entity Category. + public HealthcareEntityCategory Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + /// Assertion of the entity. + public HealthcareAssertion Assertion { get; } + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + public string Name { get; } + /// Entity references in known data sources. + public IReadOnlyList Links { get; } + /// + /// (Optional) Entity component information listing fired components of the extracted entity. This object only applies for custom healthcare. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IReadOnlyList EntityComponentInformation { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationAction.Serialization.cs new file mode 100644 index 000000000000..d54b17a0b762 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomHealthcareOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + CustomHealthcareOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareOperationAction(document.RootElement, options); + } + + internal static CustomHealthcareOperationAction DeserializeCustomHealthcareOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomHealthcareActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomHealthcareActionContent.DeserializeCustomHealthcareActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomHealthcareOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationAction.cs new file mode 100644 index 000000000000..a1c4ad499e73 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom healthcare task definition. + public partial class CustomHealthcareOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomHealthcareOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomHealthcare; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the custom healthcare task parameters. + internal CustomHealthcareOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomHealthcareActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Contains the custom healthcare task parameters. + public CustomHealthcareActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationResult.Serialization.cs new file mode 100644 index 000000000000..9d514afbcb92 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomHealthcareOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + CustomHealthcareOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareOperationResult(document.RootElement, options); + } + + internal static CustomHealthcareOperationResult DeserializeCustomHealthcareOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomHealthcareResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomHealthcareResult.DeserializeCustomHealthcareResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomHealthcareOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationResult.cs new file mode 100644 index 000000000000..af608625031b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom healthcare job result. + public partial class CustomHealthcareOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Contains the list of document results. + /// is null. + internal CustomHealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomHealthcareResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomHealthcareOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Contains the list of document results. + internal CustomHealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomHealthcareResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareOperationResult() + { + } + + /// Contains the list of document results. + public CustomHealthcareResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareResult.Serialization.cs new file mode 100644 index 000000000000..141af207a73a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareResult.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomHealthcareResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomHealthcareResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareResult(document.RootElement, options); + } + + internal static CustomHealthcareResult DeserializeCustomHealthcareResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomHealthcareActionResult.DeserializeCustomHealthcareActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareResult( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareResult.cs new file mode 100644 index 000000000000..e79fcfece476 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomHealthcareResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom healthcare result for the request. + public partial class CustomHealthcareResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// List of custom healthcare results for the document. + /// , , or is null. + internal CustomHealthcareResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// List of custom healthcare results for the document. + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareResult(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// List of custom healthcare results for the document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomLabelClassificationActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomLabelClassificationActionResult.Serialization.cs new file mode 100644 index 000000000000..f32ba7a2607b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomLabelClassificationActionResult.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomLabelClassificationActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomLabelClassificationActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomLabelClassificationActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomLabelClassificationActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomLabelClassificationActionResult(document.RootElement, options); + } + + internal static CustomLabelClassificationActionResult DeserializeCustomLabelClassificationActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationActionResult.DeserializeClassificationActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomLabelClassificationActionResult( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomLabelClassificationActionResult)} does not support writing '{options.Format}' format."); + } + } + + CustomLabelClassificationActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomLabelClassificationActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomLabelClassificationActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomLabelClassificationActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomLabelClassificationActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomLabelClassificationActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomLabelClassificationActionResult.cs new file mode 100644 index 000000000000..be06d2b035fe --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomLabelClassificationActionResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom label classification with detected language results. + public partial class CustomLabelClassificationActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Response by document. + /// , , or is null. + internal CustomLabelClassificationActionResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal CustomLabelClassificationActionResult(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomLabelClassificationActionResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationActionContent.Serialization.cs new file mode 100644 index 000000000000..9eed2d9146fa --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationActionContent.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomMultiLabelClassificationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomMultiLabelClassificationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomMultiLabelClassificationActionContent(document.RootElement, options); + } + + internal static CustomMultiLabelClassificationActionContent DeserializeCustomMultiLabelClassificationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomMultiLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomMultiLabelClassificationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomMultiLabelClassificationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomMultiLabelClassificationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomMultiLabelClassificationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationActionContent.cs new file mode 100644 index 000000000000..1819de60de7f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationActionContent.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Custom Multi Classification task. + public partial class CustomMultiLabelClassificationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomMultiLabelClassificationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomMultiLabelClassificationActionContent(bool? loggingOptOut, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomMultiLabelClassificationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationAction.Serialization.cs new file mode 100644 index 000000000000..346c128d5f74 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomMultiLabelClassificationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + CustomMultiLabelClassificationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomMultiLabelClassificationOperationAction(document.RootElement, options); + } + + internal static CustomMultiLabelClassificationOperationAction DeserializeCustomMultiLabelClassificationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomMultiLabelClassificationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomMultiLabelClassificationActionContent.DeserializeCustomMultiLabelClassificationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomMultiLabelClassificationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomMultiLabelClassificationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomMultiLabelClassificationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomMultiLabelClassificationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomMultiLabelClassificationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationAction.cs new file mode 100644 index 000000000000..fdc4a566f6a3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Use custom models to classify text into multi label taxonomy. + public partial class CustomMultiLabelClassificationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomMultiLabelClassificationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomMultiLabelClassification; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal CustomMultiLabelClassificationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomMultiLabelClassificationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public CustomMultiLabelClassificationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationResult.Serialization.cs new file mode 100644 index 000000000000..7c55c154577e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomMultiLabelClassificationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + CustomMultiLabelClassificationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomMultiLabelClassificationOperationResult(document.RootElement, options); + } + + internal static CustomMultiLabelClassificationOperationResult DeserializeCustomMultiLabelClassificationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomLabelClassificationActionResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomLabelClassificationActionResult.DeserializeCustomLabelClassificationActionResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomMultiLabelClassificationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomMultiLabelClassificationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomMultiLabelClassificationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomMultiLabelClassificationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomMultiLabelClassificationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationResult.cs new file mode 100644 index 000000000000..ef2fd7798612 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomMultiLabelClassificationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom multi label classification job result. + public partial class CustomMultiLabelClassificationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// List of results. + /// is null. + internal CustomMultiLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomLabelClassificationActionResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomMultiLabelClassificationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// List of results. + internal CustomMultiLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomLabelClassificationActionResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomMultiLabelClassificationOperationResult() + { + } + + /// List of results. + public CustomLabelClassificationActionResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentenceSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentenceSentiment.Serialization.cs new file mode 100644 index 000000000000..6159763405a5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentenceSentiment.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSentenceSentiment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomSentenceSentiment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentenceSentiment(document.RootElement, options); + } + + internal static CustomSentenceSentiment DeserializeCustomSentenceSentiment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + SentenceSentimentValue sentiment = default; + SentimentConfidenceScores confidenceScores = default; + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToSentenceSentimentValue(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support writing '{options.Format}' format."); + } + } + + CustomSentenceSentiment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentenceSentiment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentenceSentiment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentenceSentiment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentenceSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentenceSentiment.cs new file mode 100644 index 000000000000..a52f147e2e37 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentenceSentiment.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A document's sentence custom sentiment. + public partial class CustomSentenceSentiment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// or is null. + internal CustomSentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// Keeps track of any properties unknown to the library. + internal CustomSentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IDictionary serializedAdditionalRawData) + { + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentenceSentiment() + { + } + + /// The sentence text. + public string Text { get; } + /// The predicted Sentiment for the sentence. + public SentenceSentimentValue Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisActionContent.Serialization.cs new file mode 100644 index 000000000000..e462a6282017 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisActionContent.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSentimentAnalysisActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomSentimentAnalysisActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisActionContent(document.RootElement, options); + } + + internal static CustomSentimentAnalysisActionContent DeserializeCustomSentimentAnalysisActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentimentAnalysisActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisActionContent.cs new file mode 100644 index 000000000000..c5ab770779f8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisActionContent.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Custom Sentiment Analysis task. + public partial class CustomSentimentAnalysisActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomSentimentAnalysisActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Specifies the method used to interpret string offsets. + /// Keeps track of any properties unknown to the library. + internal CustomSentimentAnalysisActionContent(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationAction.Serialization.cs new file mode 100644 index 000000000000..2f506a1d2118 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSentimentAnalysisOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + CustomSentimentAnalysisOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisOperationAction(document.RootElement, options); + } + + internal static CustomSentimentAnalysisOperationAction DeserializeCustomSentimentAnalysisOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSentimentAnalysisActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomSentimentAnalysisActionContent.DeserializeCustomSentimentAnalysisActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSentimentAnalysisOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationAction.cs new file mode 100644 index 000000000000..7268d704b104 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Use custom models to ease the process of sentiment analysis from documents like product reviews. + public partial class CustomSentimentAnalysisOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomSentimentAnalysisOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomSentimentAnalysis; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Custom Sentiment Analysis task parameters. + internal CustomSentimentAnalysisOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomSentimentAnalysisActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Custom Sentiment Analysis task parameters. + public CustomSentimentAnalysisActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationResult.Serialization.cs new file mode 100644 index 000000000000..b44cfe65b3ef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSentimentAnalysisOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + CustomSentimentAnalysisOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisOperationResult(document.RootElement, options); + } + + internal static CustomSentimentAnalysisOperationResult DeserializeCustomSentimentAnalysisOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSentimentAnalysisResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomSentimentAnalysisResult.DeserializeCustomSentimentAnalysisResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSentimentAnalysisOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationResult.cs new file mode 100644 index 000000000000..1da5737b50fb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Custom Sentiment Analysis Analyze Text long tunning operation result object. + public partial class CustomSentimentAnalysisOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal CustomSentimentAnalysisOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomSentimentAnalysisResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomSentimentAnalysisOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal CustomSentimentAnalysisOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomSentimentAnalysisResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisOperationResult() + { + } + + /// Results of the task. + public CustomSentimentAnalysisResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResult.Serialization.cs new file mode 100644 index 000000000000..a9e170af6c6f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResult.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSentimentAnalysisResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomSentimentAnalysisResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisResult(document.RootElement, options); + } + + internal static CustomSentimentAnalysisResult DeserializeCustomSentimentAnalysisResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomSentimentAnalysisResultDocument.DeserializeCustomSentimentAnalysisResultDocument(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisResult( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentimentAnalysisResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResult.cs new file mode 100644 index 000000000000..f725b8b09f1c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Custom Sentiment analysis results for the input documents. + public partial class CustomSentimentAnalysisResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// The custom sentiment analysis results for each document in the input. + /// , , or is null. + internal CustomSentimentAnalysisResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// The custom sentiment analysis results for each document in the input. + /// Keeps track of any properties unknown to the library. + internal CustomSentimentAnalysisResult(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// The custom sentiment analysis results for each document in the input. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResultDocument.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResultDocument.Serialization.cs new file mode 100644 index 000000000000..26e1d09c569c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResultDocument.Serialization.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSentimentAnalysisResultDocument : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("sentences"u8); + writer.WriteStartArray(); + foreach (var item in Sentences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomSentimentAnalysisResultDocument IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisResultDocument(document.RootElement, options); + } + + internal static CustomSentimentAnalysisResultDocument DeserializeCustomSentimentAnalysisResultDocument(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DocumentSentiment sentiment = default; + SentimentConfidenceScores confidenceScores = default; + IReadOnlyList sentences = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToDocumentSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomSentenceSentiment.DeserializeCustomSentenceSentiment(item, options)); + } + sentences = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisResultDocument( + id, + warnings, + statistics, + sentiment, + confidenceScores, + sentences, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisResultDocument IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisResultDocument(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentimentAnalysisResultDocument FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisResultDocument(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResultDocument.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResultDocument.cs new file mode 100644 index 000000000000..17b9a6602492 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSentimentAnalysisResultDocument.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Custom Sentiment analysis result for a specific document. + public partial class CustomSentimentAnalysisResultDocument + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// , , or is null. + internal CustomSentimentAnalysisResultDocument(string id, IEnumerable warnings, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IEnumerable sentences) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(sentences, nameof(sentences)); + + Id = id; + Warnings = warnings.ToList(); + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal CustomSentimentAnalysisResultDocument(string id, IReadOnlyList warnings, DocumentStatistics statistics, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IReadOnlyList sentences, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisResultDocument() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + public DocumentSentiment Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The document's sentences sentiment. + public IReadOnlyList Sentences { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationActionContent.Serialization.cs new file mode 100644 index 000000000000..1986ed97d26d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationActionContent.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSingleLabelClassificationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomSingleLabelClassificationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSingleLabelClassificationActionContent(document.RootElement, options); + } + + internal static CustomSingleLabelClassificationActionContent DeserializeCustomSingleLabelClassificationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSingleLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomSingleLabelClassificationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSingleLabelClassificationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSingleLabelClassificationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSingleLabelClassificationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationActionContent.cs new file mode 100644 index 000000000000..53c9853088ce --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationActionContent.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Custom Single Classification task. + public partial class CustomSingleLabelClassificationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomSingleLabelClassificationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomSingleLabelClassificationActionContent(bool? loggingOptOut, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSingleLabelClassificationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationAction.Serialization.cs new file mode 100644 index 000000000000..698204cda445 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSingleLabelClassificationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + CustomSingleLabelClassificationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSingleLabelClassificationOperationAction(document.RootElement, options); + } + + internal static CustomSingleLabelClassificationOperationAction DeserializeCustomSingleLabelClassificationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSingleLabelClassificationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomSingleLabelClassificationActionContent.DeserializeCustomSingleLabelClassificationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSingleLabelClassificationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomSingleLabelClassificationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSingleLabelClassificationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSingleLabelClassificationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSingleLabelClassificationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationAction.cs new file mode 100644 index 000000000000..149f0b193c4a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Use custom models to classify text into single label taxonomy. + public partial class CustomSingleLabelClassificationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomSingleLabelClassificationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomSingleLabelClassification; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal CustomSingleLabelClassificationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomSingleLabelClassificationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public CustomSingleLabelClassificationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationResult.Serialization.cs new file mode 100644 index 000000000000..17042c6ef615 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class CustomSingleLabelClassificationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + CustomSingleLabelClassificationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSingleLabelClassificationOperationResult(document.RootElement, options); + } + + internal static CustomSingleLabelClassificationOperationResult DeserializeCustomSingleLabelClassificationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomLabelClassificationActionResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomLabelClassificationActionResult.DeserializeCustomLabelClassificationActionResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSingleLabelClassificationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSingleLabelClassificationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSingleLabelClassificationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSingleLabelClassificationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSingleLabelClassificationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationResult.cs new file mode 100644 index 000000000000..c191cced3d0d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/CustomSingleLabelClassificationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the custom single label classification job result. + public partial class CustomSingleLabelClassificationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// List of results. + /// is null. + internal CustomSingleLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomLabelClassificationActionResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomSingleLabelClassificationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// List of results. + internal CustomSingleLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomLabelClassificationActionResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomSingleLabelClassificationOperationResult() + { + } + + /// List of results. + public CustomLabelClassificationActionResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateMetadata.Serialization.cs new file mode 100644 index 000000000000..f088ec5f6b1c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DateMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + } + + DateMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateMetadata(document.RootElement, options); + } + + internal static DateMetadata DeserializeDateMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DateMetadata)} does not support writing '{options.Format}' format."); + } + } + + DateMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDateMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DateMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateMetadata.cs new file mode 100644 index 000000000000..8c23a1a1f810 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A Metadata for date entity instances. + public partial class DateMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal DateMetadata() + { + MetadataKind = MetadataKind.DateMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal DateMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateTimeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateTimeMetadata.Serialization.cs new file mode 100644 index 000000000000..6f0761564de7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateTimeMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DateTimeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + } + + DateTimeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateTimeMetadata(document.RootElement, options); + } + + internal static DateTimeMetadata DeserializeDateTimeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateTimeMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support writing '{options.Format}' format."); + } + } + + DateTimeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDateTimeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DateTimeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateTimeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateTimeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateTimeMetadata.cs new file mode 100644 index 000000000000..c54484115e00 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateTimeMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A Metadata for datetime entity instances. + public partial class DateTimeMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal DateTimeMetadata() + { + MetadataKind = MetadataKind.DateTimeMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal DateTimeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateValue.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateValue.Serialization.cs new file mode 100644 index 000000000000..870195d794c9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateValue.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DateValue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateValue)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("timex"u8); + writer.WriteStringValue(Timex); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + if (Optional.IsDefined(Modifier)) + { + writer.WritePropertyName("modifier"u8); + writer.WriteStringValue(Modifier.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DateValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateValue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateValue(document.RootElement, options); + } + + internal static DateValue DeserializeDateValue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string timex = default; + string value = default; + TemporalModifier? modifier = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timex"u8)) + { + timex = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("modifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifier = new TemporalModifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateValue(timex, value, modifier, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DateValue)} does not support writing '{options.Format}' format."); + } + } + + DateValue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDateValue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateValue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DateValue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateValue(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateValue.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateValue.cs new file mode 100644 index 000000000000..f23d2be70ae4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DateValue.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the date value. + public partial class DateValue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The actual time that the extracted text denote. + /// or is null. + internal DateValue(string timex, string value) + { + Argument.AssertNotNull(timex, nameof(timex)); + Argument.AssertNotNull(value, nameof(value)); + + Timex = timex; + Value = value; + } + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The actual time that the extracted text denote. + /// Modifier for datetime to indicate point of reference like before, after etc. + /// Keeps track of any properties unknown to the library. + internal DateValue(string timex, string value, TemporalModifier? modifier, IDictionary serializedAdditionalRawData) + { + Timex = timex; + Value = value; + Modifier = modifier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DateValue() + { + } + + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + public string Timex { get; } + /// The actual time that the extracted text denote. + public string Value { get; } + /// Modifier for datetime to indicate point of reference like before, after etc. + public TemporalModifier? Modifier { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DetectedLanguage.Serialization.cs new file mode 100644 index 000000000000..e56bb77f7d92 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DetectedLanguage.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("iso6391Name"u8); + writer.WriteStringValue(Iso6391Name); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (Optional.IsDefined(Script)) + { + writer.WritePropertyName("script"u8); + writer.WriteStringValue(Script.Value.ToString()); + } + if (Optional.IsDefined(ScriptCode)) + { + writer.WritePropertyName("scriptCode"u8); + writer.WriteStringValue(ScriptCode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DetectedLanguage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDetectedLanguage(document.RootElement, options); + } + + internal static DetectedLanguage DeserializeDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string iso6391Name = default; + double confidenceScore = default; + ScriptKind? script = default; + ScriptCode? scriptCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("iso6391Name"u8)) + { + iso6391Name = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("script"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + script = new ScriptKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("scriptCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptCode = new ScriptCode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DetectedLanguage( + name, + iso6391Name, + confidenceScore, + script, + scriptCode, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + DetectedLanguage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DetectedLanguage.cs new file mode 100644 index 000000000000..b7b5598047aa --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DetectedLanguage.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the details of the detected language for the text. + public partial class DetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// 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. + /// or is null. + internal DetectedLanguage(string name, string iso6391Name, double confidenceScore) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(iso6391Name, nameof(iso6391Name)); + + Name = name; + Iso6391Name = iso6391Name; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// 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. + /// Identifies the script of the input document. + /// Identifies the script of the input document. + /// Keeps track of any properties unknown to the library. + internal DetectedLanguage(string name, string iso6391Name, double confidenceScore, ScriptKind? script, ScriptCode? scriptCode, IDictionary serializedAdditionalRawData) + { + Name = name; + Iso6391Name = iso6391Name; + ConfidenceScore = confidenceScore; + Script = script; + ScriptCode = scriptCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DetectedLanguage() + { + } + + /// Long name of a detected language (e.g. English, French). + public string Name { get; } + /// A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + public string Iso6391Name { get; } + /// A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + public double ConfidenceScore { get; } + /// Identifies the script of the input document. + public ScriptKind? Script { get; } + /// Identifies the script of the input document. + public ScriptCode? ScriptCode { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml new file mode 100644 index 000000000000..cbd007ade805 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml @@ -0,0 +1,3067 @@ + + + + + +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "The WHO is issuing a warning about Monkey Pox.") + { + Language = "en", + }, new MultiLanguageInput("2", "Mo Salah plays in Liverpool FC in England.") + { + Language = "en", + }}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "Health", "Politics", "Music", "Sports" }) + { + ModelVersion = "latest", + ClassificationType = ClassificationType.Multi, + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityLinkingInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") + { + Language = "en", + }, new MultiLanguageInput("2", "Pike place market is my favorite Seattle attraction.") + { + Language = "en", + }}, + }, + ActionContent = new EntityLinkingActionContent + { + ModelVersion = "latest", + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Exclusions = { EntityCategory.Numeric }, + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Inclusions = { EntityCategory.Location }, + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + InferenceOptions = new EntityInferenceConfig + { + ExcludeNormalizedValues = true, + }, + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new MatchLongestEntityPolicyType(), + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") + { + Language = "en", + }, new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") + { + Language = "en", + }, new MultiLanguageInput("5", "My IP is 127.12.1.1 and my phone number is 5555555555") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextKeyPhraseExtractionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") + { + Language = "en", + }, new MultiLanguageInput("2", "Text Analytics is one of the Azure Cognitive Services.") + { + Language = "en", + }, new MultiLanguageInput("3", "My cat might need to see a veterinarian.") + { + Language = "en", + }}, + }, + ActionContent = new KeyPhraseActionContent + { + ModelVersion = "latest", + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextLanguageDetectionInput +{ + TextInput = new LanguageDetectionTextInput + { + LanguageInputs = { new LanguageInput("1", "Hello world"), new LanguageInput("2", "Bonjour tout le monde"), new LanguageInput("3", "Hola mundo"), new LanguageInput("4", "Tumhara naam kya hai?") }, + }, + ActionContent = new LanguageDetectionActionContent + { + ModelVersion = "latest", + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") + { + Language = "en", + }, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") + { + Language = "en", + }, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") + { + Language = "en", + }}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + ExcludePiiCategories = { PiiCategoriesExclude.UsSocialSecurityNumber }, + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") + { + Language = "en", + }, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") + { + Language = "en", + }, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") + { + Language = "en", + }}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + RedactionCharacter = RedactionCharacter.Minus, + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") + { + Language = "en", + }, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") + { + Language = "en", + }, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") + { + Language = "en", + }}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextSentimentAnalysisInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.") + { + Language = "en", + }}, + }, + ActionContent = new SentimentAnalysisActionContent + { + ModelVersion = "latest", + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> + + + +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "The WHO is issuing a warning about Monkey Pox.") + { + Language = "en", + }, new MultiLanguageInput("2", "Mo Salah plays in Liverpool FC in England.") + { + Language = "en", + }}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "Health", "Politics", "Music", "Sports" }) + { + ModelVersion = "latest", + ClassificationType = ClassificationType.Multi, + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityLinkingInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") + { + Language = "en", + }, new MultiLanguageInput("2", "Pike place market is my favorite Seattle attraction.") + { + Language = "en", + }}, + }, + ActionContent = new EntityLinkingActionContent + { + ModelVersion = "latest", + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Exclusions = { EntityCategory.Numeric }, + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Inclusions = { EntityCategory.Location }, + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + InferenceOptions = new EntityInferenceConfig + { + ExcludeNormalizedValues = true, + }, + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new MatchLongestEntityPolicyType(), + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") + { + Language = "en", + }, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") + { + Language = "en", + }, new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") + { + Language = "en", + }, new MultiLanguageInput("5", "My IP is 127.12.1.1 and my phone number is 5555555555") + { + Language = "en", + }}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextKeyPhraseExtractionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") + { + Language = "en", + }, new MultiLanguageInput("2", "Text Analytics is one of the Azure Cognitive Services.") + { + Language = "en", + }, new MultiLanguageInput("3", "My cat might need to see a veterinarian.") + { + Language = "en", + }}, + }, + ActionContent = new KeyPhraseActionContent + { + ModelVersion = "latest", + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextLanguageDetectionInput +{ + TextInput = new LanguageDetectionTextInput + { + LanguageInputs = { new LanguageInput("1", "Hello world"), new LanguageInput("2", "Bonjour tout le monde"), new LanguageInput("3", "Hola mundo"), new LanguageInput("4", "Tumhara naam kya hai?") }, + }, + ActionContent = new LanguageDetectionActionContent + { + ModelVersion = "latest", + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") + { + Language = "en", + }, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") + { + Language = "en", + }, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") + { + Language = "en", + }}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + ExcludePiiCategories = { PiiCategoriesExclude.UsSocialSecurityNumber }, + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") + { + Language = "en", + }, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") + { + Language = "en", + }, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") + { + Language = "en", + }}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + RedactionCharacter = RedactionCharacter.Minus, + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") + { + Language = "en", + }, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") + { + Language = "en", + }, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") + { + Language = "en", + }}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextSentimentAnalysisInput +{ + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.") + { + Language = "en", + }}, + }, + ActionContent = new SentimentAnalysisActionContent + { + ModelVersion = "latest", + }, +}; +Response response = client.AnalyzeText(analyzeTextInput); +]]> + + + +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "DynamicClassification", + parameters = new + { + categories = new object[] + { + "Health", + "Politics", + "Music", + "Sports" + }, + classificationType = "Multi", + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "The WHO is issuing a warning about Monkey Pox.", + }, + new + { + id = "2", + language = "en", + text = "Mo Salah plays in Liverpool FC in England.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityLinking", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "Microsoft was founded by Bill Gates and Paul Allen.", + }, + new + { + id = "2", + language = "en", + text = "Pike place market is my favorite Seattle attraction.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + exclusionList = new object[] + { + "Numeric" + }, + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "2", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + }, + new + { + id = "3", + language = "en", + text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inclusionList = new object[] + { + "Location" + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "2", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + }, + new + { + id = "3", + language = "en", + text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inferenceOptions = new + { + excludeNormalizedValues = true, + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "matchLongest", + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "4", + language = "en", + text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "2", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + }, + new + { + id = "3", + language = "en", + text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + }, + new + { + id = "4", + language = "en", + text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", + }, + new + { + id = "5", + language = "en", + text = "My IP is 127.12.1.1 and my phone number is 5555555555", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "KeyPhraseExtraction", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "Microsoft was founded by Bill Gates and Paul Allen.", + }, + new + { + id = "2", + language = "en", + text = "Text Analytics is one of the Azure Cognitive Services.", + }, + new + { + id = "3", + language = "en", + text = "My cat might need to see a veterinarian.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "LanguageDetection", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + text = "Hello world", + }, + new + { + id = "2", + text = "Bonjour tout le monde", + }, + new + { + id = "3", + text = "Hola mundo", + }, + new + { + id = "4", + text = "Tumhara naam kya hai?", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + excludePiiCategories = new object[] + { + "USSocialSecurityNumber" + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "My SSN is 859-98-0987", + }, + new + { + id = "2", + language = "en", + text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + new + { + id = "3", + language = "en", + text = "Is 998.214.865-68 your Brazilian CPF number?", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + redactionCharacter = "-", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "My SSN is 859-98-0987", + }, + new + { + id = "2", + language = "en", + text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + new + { + id = "3", + language = "en", + text = "Is 998.214.865-68 your Brazilian CPF number?", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "My SSN is 859-98-0987", + }, + new + { + id = "2", + language = "en", + text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + new + { + id = "3", + language = "en", + text = "Is 998.214.865-68 your Brazilian CPF number?", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "SentimentAnalysis", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.", + } + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "DynamicClassification", + parameters = new + { + categories = new object[] + { + "Health", + "Politics", + "Music", + "Sports" + }, + classificationType = "Multi", + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "The WHO is issuing a warning about Monkey Pox.", + }, + new + { + id = "2", + language = "en", + text = "Mo Salah plays in Liverpool FC in England.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityLinking", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "Microsoft was founded by Bill Gates and Paul Allen.", + }, + new + { + id = "2", + language = "en", + text = "Pike place market is my favorite Seattle attraction.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + exclusionList = new object[] + { + "Numeric" + }, + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "2", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + }, + new + { + id = "3", + language = "en", + text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inclusionList = new object[] + { + "Location" + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "2", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + }, + new + { + id = "3", + language = "en", + text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inferenceOptions = new + { + excludeNormalizedValues = true, + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "matchLongest", + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "4", + language = "en", + text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "2", + language = "en", + text = "When I was 5 years old I had $90.00 dollars to my name.", + }, + new + { + id = "3", + language = "en", + text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", + }, + new + { + id = "4", + language = "en", + text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", + }, + new + { + id = "5", + language = "en", + text = "My IP is 127.12.1.1 and my phone number is 5555555555", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "KeyPhraseExtraction", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "Microsoft was founded by Bill Gates and Paul Allen.", + }, + new + { + id = "2", + language = "en", + text = "Text Analytics is one of the Azure Cognitive Services.", + }, + new + { + id = "3", + language = "en", + text = "My cat might need to see a veterinarian.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "LanguageDetection", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + text = "Hello world", + }, + new + { + id = "2", + text = "Bonjour tout le monde", + }, + new + { + id = "3", + text = "Hola mundo", + }, + new + { + id = "4", + text = "Tumhara naam kya hai?", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + excludePiiCategories = new object[] + { + "USSocialSecurityNumber" + }, + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "My SSN is 859-98-0987", + }, + new + { + id = "2", + language = "en", + text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + new + { + id = "3", + language = "en", + text = "Is 998.214.865-68 your Brazilian CPF number?", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + redactionCharacter = "-", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "My SSN is 859-98-0987", + }, + new + { + id = "2", + language = "en", + text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + new + { + id = "3", + language = "en", + text = "Is 998.214.865-68 your Brazilian CPF number?", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "My SSN is 859-98-0987", + }, + new + { + id = "2", + language = "en", + text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", + }, + new + { + id = "3", + language = "en", + text = "Is 998.214.865-68 your Brazilian CPF number?", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "SentimentAnalysis", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.", + } + }, + }, +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); +]]> +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4")); +]]> +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd")); +]]> +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new AbstractiveSummarizationOperationAction + { + ActionContent = new AbstractiveSummarizationActionContent + { + SentenceCount = 1, + }, + Name = "Document Abstractive Summarization Task 1", + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "I had a wonderful trip to Seattle last week.") + { + Language = "en", + }, new MultiLanguageInput("2", "I'm flying to NYC tomorrow. See you there.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new EntitiesOperationAction + { + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + }, + Name = "Recognize Entities", + }, + new CustomEntitiesOperationAction + { + ActionContent = new CustomEntitiesActionContent("MyProject", "MyDeployment"), + Name = "Recognize US Regions", + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomAbstractiveSummarizationOperationAction(new CustomAbstractiveSummarizationActionContent("my_project", "my_deployment")) + { + Name = "Custom Document Abstractive Summarization Task 1", + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomHealthcareOperationAction + { + ActionContent = new CustomHealthcareActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "The food is great. But the service is bad.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomSentimentAnalysisOperationAction + { + ActionContent = new CustomSentimentAnalysisActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new HealthcareOperationAction + { + ActionContent = new HealthcareActionContent + { + ModelVersion = "latest", + FhirVersion = FhirVersion._401, + DocumentType = HealthcareDocumentType.DischargeSummary, + }, + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") + { + Language = "en", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new HealthcareOperationAction + { + ActionContent = new HealthcareActionContent + { + ModelVersion = "latest", + }, + } +}); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new AbstractiveSummarizationOperationAction + { + ActionContent = new AbstractiveSummarizationActionContent + { + SentenceCount = 1, + }, + Name = "Document Abstractive Summarization Task 1", + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "I had a wonderful trip to Seattle last week.") + { + Language = "en", + }, new MultiLanguageInput("2", "I'm flying to NYC tomorrow. See you there.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new EntitiesOperationAction + { + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + }, + Name = "Recognize Entities", + }, + new CustomEntitiesOperationAction + { + ActionContent = new CustomEntitiesActionContent("MyProject", "MyDeployment"), + Name = "Recognize US Regions", + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomAbstractiveSummarizationOperationAction(new CustomAbstractiveSummarizationActionContent("my_project", "my_deployment")) + { + Name = "Custom Document Abstractive Summarization Task 1", + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomHealthcareOperationAction + { + ActionContent = new CustomHealthcareActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "The food is great. But the service is bad.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomSentimentAnalysisOperationAction + { + ActionContent = new CustomSentimentAnalysisActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new HealthcareOperationAction + { + ActionContent = new HealthcareActionContent + { + ModelVersion = "latest", + FhirVersion = FhirVersion._401, + DocumentType = HealthcareDocumentType.DischargeSummary, + }, + } +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") + { + Language = "en", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new HealthcareOperationAction + { + ActionContent = new HealthcareActionContent + { + ModelVersion = "latest", + }, + } +}); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Document Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", + } + }, + }, + tasks = new object[] + { + new + { + kind = "AbstractiveSummarization", + taskName = "Document Abstractive Summarization Task 1", + parameters = new + { + sentenceCount = 1, + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Extracting Location & US Region", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "I had a wonderful trip to Seattle last week.", + }, + new + { + id = "2", + language = "en", + text = "I'm flying to NYC tomorrow. See you there.", + } + }, + }, + tasks = new object[] + { + new + { + kind = "EntityRecognition", + taskName = "Recognize Entities", + parameters = new + { + modelVersion = "latest", + }, + }, + new + { + kind = "CustomEntityRecognition", + taskName = "Recognize US Regions", + parameters = new + { + projectName = "MyProject", + deploymentName = "MyDeployment", + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Document Custom Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomAbstractiveSummarization", + taskName = "Custom Document Abstractive Summarization Task 1", + parameters = new + { + projectName = "my_project", + deploymentName = "my_deployment", + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "Prescribed 100mg ibuprofen, taken twice daily.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomHealthcare", + parameters = new + { + projectName = "{PROJECT-NAME}", + deploymentName = "{DEPLOYMENT-NAME}", + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "The food is great. But the service is bad.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomSentimentAnalysis", + parameters = new + { + projectName = "{PROJECT-NAME}", + deploymentName = "{DEPLOYMENT-NAME}", + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "Prescribed 100mg ibuprofen, taken twice daily.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "Healthcare", + parameters = new + { + modelVersion = "latest", + fhirVersion = "4.0.1", + documentType = "DischargeSummary", + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "Prescribed 100mg ibuprofen, taken twice daily.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "Healthcare", + parameters = new + { + modelVersion = "latest", + }, + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Document Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", + } + }, + }, + tasks = new object[] + { + new + { + kind = "AbstractiveSummarization", + taskName = "Document Abstractive Summarization Task 1", + parameters = new + { + sentenceCount = 1, + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Extracting Location & US Region", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "I had a wonderful trip to Seattle last week.", + }, + new + { + id = "2", + language = "en", + text = "I'm flying to NYC tomorrow. See you there.", + } + }, + }, + tasks = new object[] + { + new + { + kind = "EntityRecognition", + taskName = "Recognize Entities", + parameters = new + { + modelVersion = "latest", + }, + }, + new + { + kind = "CustomEntityRecognition", + taskName = "Recognize US Regions", + parameters = new + { + projectName = "MyProject", + deploymentName = "MyDeployment", + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Document Custom Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomAbstractiveSummarization", + taskName = "Custom Document Abstractive Summarization Task 1", + parameters = new + { + projectName = "my_project", + deploymentName = "my_deployment", + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "Prescribed 100mg ibuprofen, taken twice daily.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomHealthcare", + parameters = new + { + projectName = "{PROJECT-NAME}", + deploymentName = "{DEPLOYMENT-NAME}", + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "The food is great. But the service is bad.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomSentimentAnalysis", + parameters = new + { + projectName = "{PROJECT-NAME}", + deploymentName = "{DEPLOYMENT-NAME}", + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "Prescribed 100mg ibuprofen, taken twice daily.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "Healthcare", + parameters = new + { + modelVersion = "latest", + fhirVersion = "4.0.1", + documentType = "DischargeSummary", + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new + { + documents = new object[] + { + new + { + text = "Prescribed 100mg ibuprofen, taken twice daily.", + id = "1", + language = "en", + } + }, + }, + tasks = new object[] + { + new + { + kind = "Healthcare", + parameters = new + { + modelVersion = "latest", + }, + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> + + + +This sample shows how to call AnalyzeTextCancelOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Operation operation = await client.AnalyzeTextCancelOperationAsync(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> + + + +This sample shows how to call AnalyzeTextCancelOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Operation operation = client.AnalyzeTextCancelOperation(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> + + + \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentError.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentError.Serialization.cs new file mode 100644 index 000000000000..9f9a497e1578 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentError.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DocumentError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DocumentError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentError(document.RootElement, options); + } + + internal static DocumentError DeserializeDocumentError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + AnalyzeTextError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + error = AnalyzeTextError.DeserializeAnalyzeTextError(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentError(id, error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentError)} does not support writing '{options.Format}' format."); + } + } + + DocumentError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentError.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentError.cs new file mode 100644 index 000000000000..2cdf96030d3a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentError.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains details of errors encountered during a job execution. + public partial class DocumentError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// or is null. + internal DocumentError(string id, AnalyzeTextError error) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(error, nameof(error)); + + Id = id; + Error = error; + } + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// Keeps track of any properties unknown to the library. + internal DocumentError(string id, AnalyzeTextError error, IDictionary serializedAdditionalRawData) + { + Id = id; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentError() + { + } + + /// The ID of the input document. + public string Id { get; } + /// Error encountered. + public AnalyzeTextError Error { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentSentiment.Serialization.cs new file mode 100644 index 000000000000..22b5d56a26d3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentSentiment.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class DocumentSentimentExtensions + { + public static string ToSerialString(this DocumentSentiment value) => value switch + { + DocumentSentiment.Positive => "positive", + DocumentSentiment.Neutral => "neutral", + DocumentSentiment.Negative => "negative", + DocumentSentiment.Mixed => "mixed", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DocumentSentiment value.") + }; + + public static DocumentSentiment ToDocumentSentiment(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return DocumentSentiment.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "neutral")) return DocumentSentiment.Neutral; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return DocumentSentiment.Negative; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "mixed")) return DocumentSentiment.Mixed; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DocumentSentiment value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentSentiment.cs new file mode 100644 index 000000000000..fa822cbb84e3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentSentiment.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + public enum DocumentSentiment + { + /// Positive statement. + Positive, + /// Neutral statement. + Neutral, + /// Negative statement. + Negative, + /// Mixed statement. + Mixed + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentStatistics.Serialization.cs new file mode 100644 index 000000000000..d7cbc2dcaffc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentStatistics.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DocumentStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("charactersCount"u8); + writer.WriteNumberValue(CharactersCount); + writer.WritePropertyName("transactionsCount"u8); + writer.WriteNumberValue(TransactionsCount); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DocumentStatistics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentStatistics(document.RootElement, options); + } + + internal static DocumentStatistics DeserializeDocumentStatistics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int charactersCount = default; + int transactionsCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("charactersCount"u8)) + { + charactersCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("transactionsCount"u8)) + { + transactionsCount = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentStatistics(charactersCount, transactionsCount, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support writing '{options.Format}' format."); + } + } + + DocumentStatistics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentStatistics(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentStatistics.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentStatistics.cs new file mode 100644 index 000000000000..36f1e63dc3c2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentStatistics.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// if showStats=true was specified in the request this field will contain information about the document payload. + public partial class DocumentStatistics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of text elements recognized in the document. + /// Number of transactions for the document. + internal DocumentStatistics(int charactersCount, int transactionsCount) + { + CharactersCount = charactersCount; + TransactionsCount = transactionsCount; + } + + /// Initializes a new instance of . + /// Number of text elements recognized in the document. + /// Number of transactions for the document. + /// Keeps track of any properties unknown to the library. + internal DocumentStatistics(int charactersCount, int transactionsCount, IDictionary serializedAdditionalRawData) + { + CharactersCount = charactersCount; + TransactionsCount = transactionsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentStatistics() + { + } + + /// Number of text elements recognized in the document. + public int CharactersCount { get; } + /// Number of transactions for the document. + public int TransactionsCount { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentWarning.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentWarning.Serialization.cs new file mode 100644 index 000000000000..7ced4f1103d5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentWarning.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DocumentWarning : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentWarning)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsDefined(TargetRef)) + { + writer.WritePropertyName("targetRef"u8); + writer.WriteStringValue(TargetRef); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DocumentWarning IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentWarning)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentWarning(document.RootElement, options); + } + + internal static DocumentWarning DeserializeDocumentWarning(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WarningCode code = default; + string message = default; + string targetRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new WarningCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetRef"u8)) + { + targetRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentWarning(code, message, targetRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentWarning)} does not support writing '{options.Format}' format."); + } + } + + DocumentWarning IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentWarning(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentWarning)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentWarning FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentWarning(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentWarning.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentWarning.cs new file mode 100644 index 000000000000..b523babf6042 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DocumentWarning.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the warnings object with warnings encountered for the processed document. + public partial class DocumentWarning + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// is null. + internal DocumentWarning(WarningCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + } + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// A JSON pointer reference indicating the target object. + /// Keeps track of any properties unknown to the library. + internal DocumentWarning(WarningCode code, string message, string targetRef, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + TargetRef = targetRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentWarning() + { + } + + /// Warning code. + public WarningCode Code { get; } + /// Warning message. + public string Message { get; } + /// A JSON pointer reference indicating the target object. + public string TargetRef { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationActionContent.Serialization.cs new file mode 100644 index 000000000000..74f43285ba8b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationActionContent.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DynamicClassificationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(ClassificationType)) + { + writer.WritePropertyName("classificationType"u8); + writer.WriteStringValue(ClassificationType.Value.ToString()); + } + writer.WritePropertyName("categories"u8); + writer.WriteStartArray(); + foreach (var item in Categories) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DynamicClassificationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicClassificationActionContent(document.RootElement, options); + } + + internal static DynamicClassificationActionContent DeserializeDynamicClassificationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + ClassificationType? classificationType = default; + IList categories = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("classificationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + classificationType = new ClassificationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("categories"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + categories = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DynamicClassificationActionContent(loggingOptOut, modelVersion, classificationType, categories, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support writing '{options.Format}' format."); + } + } + + DynamicClassificationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDynamicClassificationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DynamicClassificationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDynamicClassificationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationActionContent.cs new file mode 100644 index 000000000000..c786cfccc30f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationActionContent.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Dynamic Classification task. + public partial class DynamicClassificationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// a list of categories to which input is classified to. + /// is null. + public DynamicClassificationActionContent(IEnumerable categories) + { + Argument.AssertNotNull(categories, nameof(categories)); + + Categories = categories.ToList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Specifies either one or multiple categories per document. Defaults to multi classification which may return more than one class for each document. + /// a list of categories to which input is classified to. + /// Keeps track of any properties unknown to the library. + internal DynamicClassificationActionContent(bool? loggingOptOut, string modelVersion, ClassificationType? classificationType, IList categories, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + ClassificationType = classificationType; + Categories = categories; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DynamicClassificationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Specifies either one or multiple categories per document. Defaults to multi classification which may return more than one class for each document. + public ClassificationType? ClassificationType { get; set; } + /// a list of categories to which input is classified to. + public IList Categories { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationDocumentResult.Serialization.cs new file mode 100644 index 000000000000..462872384733 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationDocumentResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DynamicClassificationDocumentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("classifications"u8); + writer.WriteStartArray(); + foreach (var item in Classifications) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DynamicClassificationDocumentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicClassificationDocumentResult(document.RootElement, options); + } + + internal static DynamicClassificationDocumentResult DeserializeDynamicClassificationDocumentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList classifications = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("classifications"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationResult.DeserializeClassificationResult(item, options)); + } + classifications = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DynamicClassificationDocumentResult(id, warnings, statistics, classifications, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support writing '{options.Format}' format."); + } + } + + DynamicClassificationDocumentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDynamicClassificationDocumentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DynamicClassificationDocumentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDynamicClassificationDocumentResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationDocumentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationDocumentResult.cs new file mode 100644 index 000000000000..dcd6f4daef44 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationDocumentResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the Dynamic Classification document result. + public partial class DynamicClassificationDocumentResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Array of classification results. + /// , or is null. + internal DynamicClassificationDocumentResult(string id, IEnumerable warnings, IEnumerable classifications) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(classifications, nameof(classifications)); + + Id = id; + Warnings = warnings.ToList(); + Classifications = classifications.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Array of classification results. + /// Keeps track of any properties unknown to the library. + internal DynamicClassificationDocumentResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList classifications, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Classifications = classifications; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DynamicClassificationDocumentResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Array of classification results. + public IReadOnlyList Classifications { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationResult.Serialization.cs new file mode 100644 index 000000000000..f35a77a7bd7f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class DynamicClassificationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DynamicClassificationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicClassificationResult(document.RootElement, options); + } + + internal static DynamicClassificationResult DeserializeDynamicClassificationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DynamicClassificationDocumentResult.DeserializeDynamicClassificationDocumentResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DynamicClassificationResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support writing '{options.Format}' format."); + } + } + + DynamicClassificationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDynamicClassificationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DynamicClassificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDynamicClassificationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationResult.cs new file mode 100644 index 000000000000..2bbb92c5e53d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/DynamicClassificationResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the Dynamic Classification result. + public partial class DynamicClassificationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal DynamicClassificationResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal DynamicClassificationResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DynamicClassificationResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesActionContent.Serialization.cs new file mode 100644 index 000000000000..c93ba791a76f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesActionContent.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntitiesActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Inclusions)) + { + writer.WritePropertyName("inclusionList"u8); + writer.WriteStartArray(); + foreach (var item in Inclusions) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Exclusions)) + { + writer.WritePropertyName("exclusionList"u8); + writer.WriteStartArray(); + foreach (var item in Exclusions) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(OverlapPolicy)) + { + writer.WritePropertyName("overlapPolicy"u8); + writer.WriteObjectValue(OverlapPolicy, options); + } + if (Optional.IsDefined(InferenceOptions)) + { + writer.WritePropertyName("inferenceOptions"u8); + writer.WriteObjectValue(InferenceOptions, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntitiesActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesActionContent(document.RootElement, options); + } + + internal static EntitiesActionContent DeserializeEntitiesActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + StringIndexType? stringIndexType = default; + IList inclusionList = default; + IList exclusionList = default; + EntityOverlapPolicy overlapPolicy = default; + EntityInferenceConfig inferenceOptions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("inclusionList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new EntityCategory(item.GetString())); + } + inclusionList = array; + continue; + } + if (property.NameEquals("exclusionList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new EntityCategory(item.GetString())); + } + exclusionList = array; + continue; + } + if (property.NameEquals("overlapPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + overlapPolicy = EntityOverlapPolicy.DeserializeEntityOverlapPolicy(property.Value, options); + continue; + } + if (property.NameEquals("inferenceOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inferenceOptions = EntityInferenceConfig.DeserializeEntityInferenceConfig(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesActionContent( + loggingOptOut, + modelVersion, + stringIndexType, + inclusionList ?? new ChangeTrackingList(), + exclusionList ?? new ChangeTrackingList(), + overlapPolicy, + inferenceOptions, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support writing '{options.Format}' format."); + } + } + + EntitiesActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntitiesActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesActionContent.cs new file mode 100644 index 000000000000..99e8400cf5fd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesActionContent.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for an Entity Recognition task. + public partial class EntitiesActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EntitiesActionContent() + { + Inclusions = new ChangeTrackingList(); + Exclusions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// (Optional) parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// (Optional) request parameter that limits the output to the requested entity types included in this list. We will apply inclusionList before exclusionList. + /// (Optional) request parameter that filters out any entities that are included the excludeList. When a user specifies an excludeList, they cannot get a prediction returned with an entity in that list. We will apply inclusionList before exclusionList. + /// + /// (Optional) describes the type of overlap policy to apply to the ner output. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// (Optional) request parameter that allows the user to provide settings for running the inference. + /// Keeps track of any properties unknown to the library. + internal EntitiesActionContent(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType, IList inclusions, IList exclusions, EntityOverlapPolicy overlapPolicy, EntityInferenceConfig inferenceOptions, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + StringIndexType = stringIndexType; + Inclusions = inclusions; + Exclusions = exclusions; + OverlapPolicy = overlapPolicy; + InferenceOptions = inferenceOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// (Optional) parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + /// (Optional) request parameter that limits the output to the requested entity types included in this list. We will apply inclusionList before exclusionList. + public IList Inclusions { get; } + /// (Optional) request parameter that filters out any entities that are included the excludeList. When a user specifies an excludeList, they cannot get a prediction returned with an entity in that list. We will apply inclusionList before exclusionList. + public IList Exclusions { get; } + /// + /// (Optional) describes the type of overlap policy to apply to the ner output. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public EntityOverlapPolicy OverlapPolicy { get; set; } + /// (Optional) request parameter that allows the user to provide settings for running the inference. + public EntityInferenceConfig InferenceOptions { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs new file mode 100644 index 000000000000..0bb663429fc6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntitiesDocumentResultWithMetadataDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntitiesDocumentResultWithMetadataDetectedLanguage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(document.RootElement, options); + } + + internal static EntitiesDocumentResultWithMetadataDetectedLanguage DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntityWithMetadata.DeserializeNamedEntityWithMetadata(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesDocumentResultWithMetadataDetectedLanguage( + id, + warnings, + statistics, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + EntitiesDocumentResultWithMetadataDetectedLanguage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntitiesDocumentResultWithMetadataDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesDocumentResultWithMetadataDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesDocumentResultWithMetadataDetectedLanguage.cs new file mode 100644 index 000000000000..719cd5270faa --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesDocumentResultWithMetadataDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the entity recognition task result for the document with metadata and detected language. + public partial class EntitiesDocumentResultWithMetadataDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Recognized entities in the document. + /// , or is null. + internal EntitiesDocumentResultWithMetadataDetectedLanguage(string id, IEnumerable warnings, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal EntitiesDocumentResultWithMetadataDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntitiesDocumentResultWithMetadataDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Recognized entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesOperationAction.Serialization.cs new file mode 100644 index 000000000000..64dc6f507fff --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntitiesOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + EntitiesOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesOperationAction(document.RootElement, options); + } + + internal static EntitiesOperationAction DeserializeEntitiesOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntitiesActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntitiesActionContent.DeserializeEntitiesActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support writing '{options.Format}' format."); + } + } + + EntitiesOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntitiesOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesOperationAction.cs new file mode 100644 index 000000000000..f9b82d67a768 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the task definition for an Entities Recognition task. + public partial class EntitiesOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public EntitiesOperationAction() + { + Kind = AnalyzeTextOperationActionKind.EntityRecognition; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal EntitiesOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, EntitiesActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public EntitiesActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesResult.Serialization.cs new file mode 100644 index 000000000000..1138f92b9341 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntitiesResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntitiesResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesResult(document.RootElement, options); + } + + internal static EntitiesResult DeserializeEntitiesResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntitiesDocumentResultWithMetadataDetectedLanguage.DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesResult)} does not support writing '{options.Format}' format."); + } + } + + EntitiesResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntitiesResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesResult.cs new file mode 100644 index 000000000000..cef0b80c969c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntitiesResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the entity recognition task result. + public partial class EntitiesResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal EntitiesResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal EntitiesResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntitiesResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityActionResult.Serialization.cs new file mode 100644 index 000000000000..423e7df17d5c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityActionResult.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityActionResult(document.RootElement, options); + } + + internal static EntityActionResult DeserializeEntityActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntity.DeserializeNamedEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityActionResult( + id, + warnings, + statistics, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityActionResult)} does not support writing '{options.Format}' format."); + } + } + + EntityActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityActionResult.cs new file mode 100644 index 000000000000..ca4242d15ba3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityActionResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the entity recognition task result for the document with detected language. + public partial class EntityActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Recognized entities in the document. + /// , or is null. + internal EntityActionResult(string id, IEnumerable warnings, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal EntityActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Recognized entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityCategory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityCategory.cs new file mode 100644 index 000000000000..d8b7f57ea057 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityCategory.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Contains all the entity categories detected by entity recognition. + public readonly partial struct EntityCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EntityCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddressValue = "Address"; + private const string NumericValue = "Numeric"; + private const string AgeValue = "Age"; + private const string CurrencyValue = "Currency"; + private const string NumberValue = "Number"; + private const string NumberRangeValue = "NumberRange"; + private const string PercentageValue = "Percentage"; + private const string OrdinalValue = "Ordinal"; + private const string TemperatureValue = "Temperature"; + private const string DimensionValue = "Dimension"; + private const string LengthValue = "Length"; + private const string WeightValue = "Weight"; + private const string HeightValue = "Height"; + private const string SpeedValue = "Speed"; + private const string AreaValue = "Area"; + private const string VolumeValue = "Volume"; + private const string InformationValue = "Information"; + private const string TemporalValue = "Temporal"; + private const string DateValue = "Date"; + private const string TimeValue = "Time"; + private const string DateTimeValue = "DateTime"; + private const string DateRangeValue = "DateRange"; + private const string TimeRangeValue = "TimeRange"; + private const string DateTimeRangeValue = "DateTimeRange"; + private const string DurationValue = "Duration"; + private const string SetTemporalValue = "SetTemporal"; + private const string EventValue = "Event"; + private const string SportsEventValue = "SportsEvent"; + private const string CulturalEventValue = "CulturalEvent"; + private const string NaturalEventValue = "NaturalEvent"; + private const string LocationValue = "Location"; + private const string GeoPoliticalEntityValue = "GPE"; + private const string CityValue = "City"; + private const string StateValue = "State"; + private const string CountryRegionValue = "CountryRegion"; + private const string ContinentValue = "Continent"; + private const string StructuralValue = "Structural"; + private const string AirportValue = "Airport"; + private const string GeologicalValue = "Geological"; + private const string OrganizationValue = "Organization"; + private const string OrganizationMedicalValue = "OrganizationMedical"; + private const string OrganizationStockExchangeValue = "OrganizationStockExchange"; + private const string OrganizationSportsValue = "OrganizationSports"; + private const string PersonValue = "Person"; + private const string PersonTypeValue = "PersonType"; + private const string EmailValue = "Email"; + private const string UriValue = "URL"; + private const string IpAddressValue = "IP"; + private const string PhoneNumberValue = "PhoneNumber"; + private const string ProductValue = "Product"; + private const string ComputingProductValue = "ComputingProduct"; + private const string SkillValue = "Skill"; + + /// Specific street-level mentions of locations: house/building numbers, streets, avenues, highways, intersections referenced by name. + public static EntityCategory Address { get; } = new EntityCategory(AddressValue); + /// Numeric values, including digits and number words. + public static EntityCategory Numeric { get; } = new EntityCategory(NumericValue); + /// Age-related values. + public static EntityCategory Age { get; } = new EntityCategory(AgeValue); + /// Currency-related values. + public static EntityCategory Currency { get; } = new EntityCategory(CurrencyValue); + /// Numbers without a unit. + public static EntityCategory Number { get; } = new EntityCategory(NumberValue); + /// Range of Numbers. + public static EntityCategory NumberRange { get; } = new EntityCategory(NumberRangeValue); + /// Percentage-related values. + public static EntityCategory Percentage { get; } = new EntityCategory(PercentageValue); + /// Ordinal numbers. + public static EntityCategory Ordinal { get; } = new EntityCategory(OrdinalValue); + /// Temperature-related values. + public static EntityCategory Temperature { get; } = new EntityCategory(TemperatureValue); + /// Dimension of measurements. + public static EntityCategory Dimension { get; } = new EntityCategory(DimensionValue); + /// Length of an object. + public static EntityCategory Length { get; } = new EntityCategory(LengthValue); + /// Weight of an object. + public static EntityCategory Weight { get; } = new EntityCategory(WeightValue); + /// Height of an object. + public static EntityCategory Height { get; } = new EntityCategory(HeightValue); + /// Speed of an object. + public static EntityCategory Speed { get; } = new EntityCategory(SpeedValue); + /// Area of an object. + public static EntityCategory Area { get; } = new EntityCategory(AreaValue); + /// Volume of an object. + public static EntityCategory Volume { get; } = new EntityCategory(VolumeValue); + /// Unit of measure for digital information. + public static EntityCategory Information { get; } = new EntityCategory(InformationValue); + /// Items relating to time. + public static EntityCategory Temporal { get; } = new EntityCategory(TemporalValue); + /// Calendar dates. + public static EntityCategory Date { get; } = new EntityCategory(DateValue); + /// Times of day. + public static EntityCategory Time { get; } = new EntityCategory(TimeValue); + /// Calendar dates with time. + public static EntityCategory DateTime { get; } = new EntityCategory(DateTimeValue); + /// Range of dates. + public static EntityCategory DateRange { get; } = new EntityCategory(DateRangeValue); + /// Range of times. + public static EntityCategory TimeRange { get; } = new EntityCategory(TimeRangeValue); + /// Range of date and time. + public static EntityCategory DateTimeRange { get; } = new EntityCategory(DateTimeRangeValue); + /// Duration of time. + public static EntityCategory Duration { get; } = new EntityCategory(DurationValue); + /// Set of time-related values. + public static EntityCategory SetTemporal { get; } = new EntityCategory(SetTemporalValue); + /// Social, sports, business, political, educational, natural, historical, criminal, violent, legal, military events with a timed period. + public static EntityCategory Event { get; } = new EntityCategory(EventValue); + /// Sports event-related values. + public static EntityCategory SportsEvent { get; } = new EntityCategory(SportsEventValue); + /// Cultural event-related values. + public static EntityCategory CulturalEvent { get; } = new EntityCategory(CulturalEventValue); + /// Natural event-related values. + public static EntityCategory NaturalEvent { get; } = new EntityCategory(NaturalEventValue); + /// Particular point or place in physical space. + public static EntityCategory Location { get; } = new EntityCategory(LocationValue); + /// Cities, countries/regions, states. + public static EntityCategory GeoPoliticalEntity { get; } = new EntityCategory(GeoPoliticalEntityValue); + /// City-related values. + public static EntityCategory City { get; } = new EntityCategory(CityValue); + /// State-related values. + public static EntityCategory State { get; } = new EntityCategory(StateValue); + /// Country or region-related values. + public static EntityCategory CountryRegion { get; } = new EntityCategory(CountryRegionValue); + /// Continent-related values. + public static EntityCategory Continent { get; } = new EntityCategory(ContinentValue); + /// Manmade structures. + public static EntityCategory Structural { get; } = new EntityCategory(StructuralValue); + /// Airports. + public static EntityCategory Airport { get; } = new EntityCategory(AirportValue); + /// Geographic and natural features such as rivers, oceans, and deserts. + public static EntityCategory Geological { get; } = new EntityCategory(GeologicalValue); + /// Corporations, agencies, and other groups of people defined by some established organizational structure. These labels can include companies, political parties/movements, musical bands, sport clubs, government bodies, and public organizations. Nationalities or religions are not ORGANIZATION. + public static EntityCategory Organization { get; } = new EntityCategory(OrganizationValue); + /// Medical companies and groups. + public static EntityCategory OrganizationMedical { get; } = new EntityCategory(OrganizationMedicalValue); + /// Stock exchange groups. + public static EntityCategory OrganizationStockExchange { get; } = new EntityCategory(OrganizationStockExchangeValue); + /// Sports-related organizations. + public static EntityCategory OrganizationSports { get; } = new EntityCategory(OrganizationSportsValue); + /// First, last, and middle names, names of fictional characters, and aliases. Titles, such as 'Mr.' or 'President', are not considered part of the named entity. + public static EntityCategory Person { get; } = new EntityCategory(PersonValue); + /// Human roles classified by a group membership. + public static EntityCategory PersonType { get; } = new EntityCategory(PersonTypeValue); + /// Email addresses. + public static EntityCategory Email { get; } = new EntityCategory(EmailValue); + /// URLs to websites. + public static EntityCategory Uri { get; } = new EntityCategory(UriValue); + /// network IP addresses. + public static EntityCategory IpAddress { get; } = new EntityCategory(IpAddressValue); + /// Phone numbers (US and EU phone numbers only). + public static EntityCategory PhoneNumber { get; } = new EntityCategory(PhoneNumberValue); + /// Single or group of commercial, consumable objects, electronics, vehicles, food groups. + public static EntityCategory Product { get; } = new EntityCategory(ProductValue); + /// Computing products. + public static EntityCategory ComputingProduct { get; } = new EntityCategory(ComputingProductValue); + /// A capability, skill, or expertise. + public static EntityCategory Skill { get; } = new EntityCategory(SkillValue); + /// Determines if two values are the same. + public static bool operator ==(EntityCategory left, EntityCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EntityCategory left, EntityCategory right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EntityCategory(string value) => new EntityCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EntityCategory other && Equals(other); + /// + public bool Equals(EntityCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentInformation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentInformation.Serialization.cs new file mode 100644 index 000000000000..38665062d81a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentInformation.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownEntityComponentInformation))] + public partial class EntityComponentInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("entityComponentKind"u8); + writer.WriteStringValue(EntityComponentKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityComponentInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + + internal static EntityComponentInformation DeserializeEntityComponentInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("entityComponentKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "LearnedComponent": return LearnedComponent.DeserializeLearnedComponent(element, options); + case "ListComponent": return ListComponent.DeserializeListComponent(element, options); + case "PrebuiltComponent": return PrebuiltComponent.DeserializePrebuiltComponent(element, options); + } + } + return UnknownEntityComponentInformation.DeserializeUnknownEntityComponentInformation(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{options.Format}' format."); + } + } + + EntityComponentInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityComponentInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityComponentInformation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentInformation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentInformation.cs new file mode 100644 index 000000000000..d0faa0838e2c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentInformation.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// This object contains information of the detected entity components. The possible component types may expand in the future. Parsing code should handle unexpected values gracefully + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class EntityComponentInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected EntityComponentInformation() + { + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + internal EntityComponentInformation(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData) + { + EntityComponentKind = entityComponentKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Kind of entity component. + internal EntityComponentKind EntityComponentKind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentKind.cs new file mode 100644 index 000000000000..71668dddfd1a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityComponentKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Kind of entity components supported. + internal readonly partial struct EntityComponentKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EntityComponentKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrebuiltComponentValue = "PrebuiltComponent"; + private const string LearnedComponentValue = "LearnedComponent"; + private const string ListComponentValue = "ListComponent"; + + /// Prebuilt component. + public static EntityComponentKind PrebuiltComponent { get; } = new EntityComponentKind(PrebuiltComponentValue); + /// Learned component. + public static EntityComponentKind LearnedComponent { get; } = new EntityComponentKind(LearnedComponentValue); + /// List component. + public static EntityComponentKind ListComponent { get; } = new EntityComponentKind(ListComponentValue); + /// Determines if two values are the same. + public static bool operator ==(EntityComponentKind left, EntityComponentKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EntityComponentKind left, EntityComponentKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EntityComponentKind(string value) => new EntityComponentKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EntityComponentKind other && Equals(other); + /// + public bool Equals(EntityComponentKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityInferenceConfig.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityInferenceConfig.Serialization.cs new file mode 100644 index 000000000000..b2cb5909e93d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityInferenceConfig.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityInferenceConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ExcludeNormalizedValues)) + { + writer.WritePropertyName("excludeNormalizedValues"u8); + writer.WriteBooleanValue(ExcludeNormalizedValues.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityInferenceConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityInferenceConfig(document.RootElement, options); + } + + internal static EntityInferenceConfig DeserializeEntityInferenceConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? excludeNormalizedValues = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("excludeNormalizedValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + excludeNormalizedValues = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityInferenceConfig(excludeNormalizedValues, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support writing '{options.Format}' format."); + } + } + + EntityInferenceConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityInferenceConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityInferenceConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityInferenceConfig(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityInferenceConfig.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityInferenceConfig.cs new file mode 100644 index 000000000000..2302fcf02c2a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityInferenceConfig.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The class that houses the inference options allowed for named entity recognition. + public partial class EntityInferenceConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EntityInferenceConfig() + { + } + + /// Initializes a new instance of . + /// Option to include/exclude the detected entity values to be normalized and included in the metadata. The numeric and temporal entity types support value normalization. + /// Keeps track of any properties unknown to the library. + internal EntityInferenceConfig(bool? excludeNormalizedValues, IDictionary serializedAdditionalRawData) + { + ExcludeNormalizedValues = excludeNormalizedValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Option to include/exclude the detected entity values to be normalized and included in the metadata. The numeric and temporal entity types support value normalization. + public bool? ExcludeNormalizedValues { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionContent.Serialization.cs new file mode 100644 index 000000000000..e40ada2ac99c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionContent.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityLinkingActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityLinkingActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingActionContent(document.RootElement, options); + } + + internal static EntityLinkingActionContent DeserializeEntityLinkingActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingActionContent(loggingOptOut, modelVersion, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionContent.cs new file mode 100644 index 000000000000..f37333b90d67 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionContent.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for an Entity Linking task. + public partial class EntityLinkingActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EntityLinkingActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// Keeps track of any properties unknown to the library. + internal EntityLinkingActionContent(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionResult.Serialization.cs new file mode 100644 index 000000000000..848805291139 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionResult.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityLinkingActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityLinkingActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingActionResult(document.RootElement, options); + } + + internal static EntityLinkingActionResult DeserializeEntityLinkingActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LinkedEntity.DeserializeLinkedEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingActionResult( + id, + warnings, + statistics, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingActionResult)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionResult.cs new file mode 100644 index 000000000000..c401ffe4e4e3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingActionResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Entity linking document result with auto language detection. + public partial class EntityLinkingActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Recognized well known entities in the document. + /// , or is null. + internal EntityLinkingActionResult(string id, IEnumerable warnings, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized well known entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal EntityLinkingActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Recognized well known entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingMatch.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingMatch.Serialization.cs new file mode 100644 index 000000000000..ea3e9286f949 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingMatch.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityLinkingMatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityLinkingMatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingMatch(document.RootElement, options); + } + + internal static EntityLinkingMatch DeserializeEntityLinkingMatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double confidenceScore = default; + string text = default; + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingMatch(confidenceScore, text, offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingMatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingMatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingMatch FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingMatch(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingMatch.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingMatch.cs new file mode 100644 index 000000000000..cfcda8f904e6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingMatch.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The Match object containing the detected entity text with the offset and the length. + public partial class EntityLinkingMatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + /// Entity text as appears in the request. + /// Start position for the entity match text. + /// Length for the entity match text. + /// is null. + internal EntityLinkingMatch(double confidenceScore, string text, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + + ConfidenceScore = confidenceScore; + Text = text; + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + /// Entity text as appears in the request. + /// Start position for the entity match text. + /// Length for the entity match text. + /// Keeps track of any properties unknown to the library. + internal EntityLinkingMatch(double confidenceScore, string text, int offset, int length, IDictionary serializedAdditionalRawData) + { + ConfidenceScore = confidenceScore; + Text = text; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingMatch() + { + } + + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + public double ConfidenceScore { get; } + /// Entity text as appears in the request. + public string Text { get; } + /// Start position for the entity match text. + public int Offset { get; } + /// Length for the entity match text. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationAction.Serialization.cs new file mode 100644 index 000000000000..ce7681ea08e0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityLinkingOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + EntityLinkingOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingOperationAction(document.RootElement, options); + } + + internal static EntityLinkingOperationAction DeserializeEntityLinkingOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityLinkingActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntityLinkingActionContent.DeserializeEntityLinkingActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntityLinkingOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationAction.cs new file mode 100644 index 000000000000..9e55a8b4f29a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text Entity linking LRO task. + public partial class EntityLinkingOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public EntityLinkingOperationAction() + { + Kind = AnalyzeTextOperationActionKind.EntityLinking; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal EntityLinkingOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, EntityLinkingActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public EntityLinkingActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationResult.Serialization.cs new file mode 100644 index 000000000000..5c2092d1e792 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityLinkingOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + EntityLinkingOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingOperationResult(document.RootElement, options); + } + + internal static EntityLinkingOperationResult DeserializeEntityLinkingOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityLinkingResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntityLinkingResult.DeserializeEntityLinkingResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntityLinkingOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationResult.cs new file mode 100644 index 000000000000..46d40adf1a1f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text Entity linking task LRO result. + public partial class EntityLinkingOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Entity linking result. + /// is null. + internal EntityLinkingOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, EntityLinkingResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.EntityLinkingOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Entity linking result. + internal EntityLinkingOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, EntityLinkingResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingOperationResult() + { + } + + /// Entity linking result. + public EntityLinkingResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingResult.Serialization.cs new file mode 100644 index 000000000000..0f42c3f72d0b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityLinkingResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityLinkingResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingResult(document.RootElement, options); + } + + internal static EntityLinkingResult DeserializeEntityLinkingResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityLinkingActionResult.DeserializeEntityLinkingActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingResult.cs new file mode 100644 index 000000000000..b6dce4d814ab --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityLinkingResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Entity linking result. + public partial class EntityLinkingResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal EntityLinkingResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal EntityLinkingResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityOverlapPolicy.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityOverlapPolicy.Serialization.cs new file mode 100644 index 000000000000..487bbd2266fb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityOverlapPolicy.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + [PersistableModelProxy(typeof(UnknownEntityOverlapPolicy))] + public partial class EntityOverlapPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("policyKind"u8); + writer.WriteStringValue(PolicyKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityOverlapPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + + internal static EntityOverlapPolicy DeserializeEntityOverlapPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("policyKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "allowOverlap": return AllowOverlapEntityPolicyType.DeserializeAllowOverlapEntityPolicyType(element, options); + case "matchLongest": return MatchLongestEntityPolicyType.DeserializeMatchLongestEntityPolicyType(element, options); + } + } + return UnknownEntityOverlapPolicy.DeserializeUnknownEntityOverlapPolicy(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{options.Format}' format."); + } + } + + EntityOverlapPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityOverlapPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityOverlapPolicy(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityOverlapPolicy.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityOverlapPolicy.cs new file mode 100644 index 000000000000..038be62aa934 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityOverlapPolicy.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// + /// The abstract base class for entity OverlapPolicy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class EntityOverlapPolicy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected EntityOverlapPolicy() + { + } + + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal EntityOverlapPolicy(PolicyKind policyKind, IDictionary serializedAdditionalRawData) + { + PolicyKind = policyKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity OverlapPolicy object kind. + internal PolicyKind PolicyKind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityRecognitionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 000000000000..73eab351b864 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityRecognitionOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityRecognitionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + EntityRecognitionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityRecognitionOperationResult(document.RootElement, options); + } + + internal static EntityRecognitionOperationResult DeserializeEntityRecognitionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntitiesResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntitiesResult.DeserializeEntitiesResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + EntityRecognitionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityRecognitionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntityRecognitionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityRecognitionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityRecognitionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityRecognitionOperationResult.cs new file mode 100644 index 000000000000..08976c678464 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityRecognitionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the entity recognition job task result. + public partial class EntityRecognitionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results for the task. + /// is null. + internal EntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, EntitiesResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.EntityRecognitionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results for the task. + internal EntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, EntitiesResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal EntityRecognitionOperationResult() + { + } + + /// Results for the task. + public EntitiesResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityTag.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityTag.Serialization.cs new file mode 100644 index 000000000000..2da0cd28d59d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityTag.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class EntityTag : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityTag)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(ConfidenceScore)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EntityTag IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityTag)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityTag(document.RootElement, options); + } + + internal static EntityTag DeserializeEntityTag(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + double? confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityTag(name, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityTag)} does not support writing '{options.Format}' format."); + } + } + + EntityTag IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityTag(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityTag)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityTag FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityTag(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityTag.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityTag.cs new file mode 100644 index 000000000000..7578d09efc88 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/EntityTag.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Entity tag object which contains the name of the tags abd any associated confidence score. Entity Tags are used to express some similarities/affinity between entities. + public partial class EntityTag + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the tag. Entity Tag names will be unique globally. + /// is null. + internal EntityTag(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// Name of the tag. Entity Tag names will be unique globally. + /// Detection score between 0 and 1 of the extracted entity. + /// Keeps track of any properties unknown to the library. + internal EntityTag(string name, double? confidenceScore, IDictionary serializedAdditionalRawData) + { + Name = name; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityTag() + { + } + + /// Name of the tag. Entity Tag names will be unique globally. + public string Name { get; } + /// Detection score between 0 and 1 of the extracted entity. + public double? ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummaryActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummaryActionResult.Serialization.cs new file mode 100644 index 000000000000..d8f99f2cfb52 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummaryActionResult.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ExtractedSummaryActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummaryActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("sentences"u8); + writer.WriteStartArray(); + foreach (var item in Sentences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExtractedSummaryActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummaryActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractedSummaryActionResult(document.RootElement, options); + } + + internal static ExtractedSummaryActionResult DeserializeExtractedSummaryActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList sentences = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExtractedSummarySentence.DeserializeExtractedSummarySentence(item, options)); + } + sentences = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractedSummaryActionResult( + id, + warnings, + statistics, + sentences, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractedSummaryActionResult)} does not support writing '{options.Format}' format."); + } + } + + ExtractedSummaryActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractedSummaryActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractedSummaryActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractedSummaryActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractedSummaryActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummaryActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummaryActionResult.cs new file mode 100644 index 000000000000..eea9ea0fe2ad --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummaryActionResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// A ranked list of sentences representing the extracted summary. + public partial class ExtractedSummaryActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Specifies the the extracted sentences from the input document. + /// , or is null. + internal ExtractedSummaryActionResult(string id, IEnumerable warnings, IEnumerable sentences) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(sentences, nameof(sentences)); + + Id = id; + Warnings = warnings.ToList(); + Sentences = sentences.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Specifies the the extracted sentences from the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal ExtractedSummaryActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList sentences, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Sentences = sentences; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtractedSummaryActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Specifies the the extracted sentences from the input document. + public IReadOnlyList Sentences { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummarySentence.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummarySentence.Serialization.cs new file mode 100644 index 000000000000..d431d9be3273 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummarySentence.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ExtractedSummarySentence : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("rankScore"u8); + writer.WriteNumberValue(RankScore); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExtractedSummarySentence IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractedSummarySentence(document.RootElement, options); + } + + internal static ExtractedSummarySentence DeserializeExtractedSummarySentence(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + double rankScore = default; + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("rankScore"u8)) + { + rankScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractedSummarySentence(text, rankScore, offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support writing '{options.Format}' format."); + } + } + + ExtractedSummarySentence IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractedSummarySentence(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractedSummarySentence FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractedSummarySentence(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummarySentence.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummarySentence.cs new file mode 100644 index 000000000000..068fea05b6c3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractedSummarySentence.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents an extracted sentences from the input document. + public partial class ExtractedSummarySentence + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The extracted sentence text. + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + /// The length of the sentence. + /// is null. + internal ExtractedSummarySentence(string text, double rankScore, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + RankScore = rankScore; + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// The extracted sentence text. + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + /// The length of the sentence. + /// Keeps track of any properties unknown to the library. + internal ExtractedSummarySentence(string text, double rankScore, int offset, int length, IDictionary serializedAdditionalRawData) + { + Text = text; + RankScore = rankScore; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtractedSummarySentence() + { + } + + /// The extracted sentence text. + public string Text { get; } + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + public double RankScore { get; } + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + public int Offset { get; } + /// The length of the sentence. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 000000000000..18ec20eda761 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationActionContent.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ExtractiveSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(SentenceCount)) + { + writer.WritePropertyName("sentenceCount"u8); + writer.WriteNumberValue(SentenceCount.Value); + } + if (Optional.IsDefined(SortBy)) + { + writer.WritePropertyName("sortBy"u8); + writer.WriteStringValue(SortBy.Value.ToString()); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(Query)) + { + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExtractiveSummarizationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationActionContent(document.RootElement, options); + } + + internal static ExtractiveSummarizationActionContent DeserializeExtractiveSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + long? sentenceCount = default; + ExtractiveSummarizationSortingCriteria? sortBy = default; + StringIndexType? stringIndexType = default; + string query = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("sortBy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sortBy = new ExtractiveSummarizationSortingCriteria(property.Value.GetString()); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationActionContent( + loggingOptOut, + modelVersion, + sentenceCount, + sortBy, + stringIndexType, + query, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractiveSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationActionContent.cs new file mode 100644 index 000000000000..afb58ee95b1c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationActionContent.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for an Extractive Summarization task. + public partial class ExtractiveSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ExtractiveSummarizationActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Specifies the number of sentences in the extracted summary. + /// Specifies how to sort the extracted summaries. + /// Specifies the method used to interpret string offsets. + /// (Optional) If provided, the query will be used to extract most relevant sentences from the document. + /// Keeps track of any properties unknown to the library. + internal ExtractiveSummarizationActionContent(bool? loggingOptOut, string modelVersion, long? sentenceCount, ExtractiveSummarizationSortingCriteria? sortBy, StringIndexType? stringIndexType, string query, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + SortBy = sortBy; + StringIndexType = stringIndexType; + Query = query; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Specifies the number of sentences in the extracted summary. + public long? SentenceCount { get; set; } + /// Specifies how to sort the extracted summaries. + public ExtractiveSummarizationSortingCriteria? SortBy { get; set; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + /// (Optional) If provided, the query will be used to extract most relevant sentences from the document. + public string Query { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 000000000000..aff3146ea93d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ExtractiveSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + ExtractiveSummarizationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationOperationAction(document.RootElement, options); + } + + internal static ExtractiveSummarizationOperationAction DeserializeExtractiveSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExtractiveSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = ExtractiveSummarizationActionContent.DeserializeExtractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ExtractiveSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationAction.cs new file mode 100644 index 000000000000..50f98cca2373 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the task definition for an Extractive Summarization task. + public partial class ExtractiveSummarizationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public ExtractiveSummarizationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.ExtractiveSummarization; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Extractive Summarization task. + internal ExtractiveSummarizationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, ExtractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Extractive Summarization task. + public ExtractiveSummarizationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 000000000000..ea28f3192b9b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ExtractiveSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + ExtractiveSummarizationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationOperationResult(document.RootElement, options); + } + + internal static ExtractiveSummarizationOperationResult DeserializeExtractiveSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExtractiveSummarizationResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = ExtractiveSummarizationResult.DeserializeExtractiveSummarizationResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ExtractiveSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationResult.cs new file mode 100644 index 000000000000..2d1916a81952 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the results for an Extractive Summarization task. + public partial class ExtractiveSummarizationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.ExtractiveSummarizationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal ExtractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public ExtractiveSummarizationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationResult.Serialization.cs new file mode 100644 index 000000000000..15e4eca63b7e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ExtractiveSummarizationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExtractiveSummarizationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationResult(document.RootElement, options); + } + + internal static ExtractiveSummarizationResult DeserializeExtractiveSummarizationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExtractedSummaryActionResult.DeserializeExtractedSummaryActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractiveSummarizationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationResult.cs new file mode 100644 index 000000000000..e257e5ea3636 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// An object representing the pre-built Extractive Summarization results of each document. + public partial class ExtractiveSummarizationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal ExtractiveSummarizationResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal ExtractiveSummarizationResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtractiveSummarizationResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationSortingCriteria.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationSortingCriteria.cs new file mode 100644 index 000000000000..6979fda1e6af --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ExtractiveSummarizationSortingCriteria.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The sorting criteria to use for the results of Extractive Summarization. + public readonly partial struct ExtractiveSummarizationSortingCriteria : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExtractiveSummarizationSortingCriteria(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OffsetValue = "Offset"; + private const string RankValue = "Rank"; + + /// Indicates that results should be sorted in order of appearance in the text. + public static ExtractiveSummarizationSortingCriteria Offset { get; } = new ExtractiveSummarizationSortingCriteria(OffsetValue); + /// Indicates that results should be sorted in order of importance (i.e. rank score) according to the model. + public static ExtractiveSummarizationSortingCriteria Rank { get; } = new ExtractiveSummarizationSortingCriteria(RankValue); + /// Determines if two values are the same. + public static bool operator ==(ExtractiveSummarizationSortingCriteria left, ExtractiveSummarizationSortingCriteria right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExtractiveSummarizationSortingCriteria left, ExtractiveSummarizationSortingCriteria right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ExtractiveSummarizationSortingCriteria(string value) => new ExtractiveSummarizationSortingCriteria(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExtractiveSummarizationSortingCriteria other && Equals(other); + /// + public bool Equals(ExtractiveSummarizationSortingCriteria other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirBundle.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirBundle.Serialization.cs new file mode 100644 index 000000000000..eded09a130d3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirBundle.Serialization.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class FhirBundle : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FhirBundle)} does not support writing '{format}' format."); + } + + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + + FhirBundle IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FhirBundle)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFhirBundle(document.RootElement, options); + } + + internal static FhirBundle DeserializeFhirBundle(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new FhirBundle(additionalProperties); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FhirBundle)} does not support writing '{options.Format}' format."); + } + } + + FhirBundle IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFhirBundle(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FhirBundle)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FhirBundle FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeFhirBundle(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirBundle.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirBundle.cs new file mode 100644 index 000000000000..dfb0eccceafd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirBundle.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + public partial class FhirBundle + { + /// Initializes a new instance of . + internal FhirBundle() + { + AdditionalProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Additional Properties. + internal FhirBundle(IReadOnlyDictionary additionalProperties) + { + AdditionalProperties = additionalProperties; + } + + /// + /// Additional Properties + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IReadOnlyDictionary AdditionalProperties { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirVersion.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirVersion.cs new file mode 100644 index 000000000000..2776570c32af --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/FhirVersion.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The FHIR Spec version. + public readonly partial struct FhirVersion : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FhirVersion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string _401Value = "4.0.1"; + + /// Version 4.0.1. + public static FhirVersion _401 { get; } = new FhirVersion(_401Value); + /// Determines if two values are the same. + public static bool operator ==(FhirVersion left, FhirVersion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FhirVersion left, FhirVersion right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FhirVersion(string value) => new FhirVersion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FhirVersion other && Equals(other); + /// + public bool Equals(FhirVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionContent.Serialization.cs new file mode 100644 index 000000000000..b89c73ca7121 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionContent.Serialization.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(FhirVersion)) + { + writer.WritePropertyName("fhirVersion"u8); + writer.WriteStringValue(FhirVersion.Value.ToString()); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("documentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareActionContent(document.RootElement, options); + } + + internal static HealthcareActionContent DeserializeHealthcareActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + StringIndexType? stringIndexType = default; + FhirVersion? fhirVersion = default; + HealthcareDocumentType? documentType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("fhirVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fhirVersion = new FhirVersion(property.Value.GetString()); + continue; + } + if (property.NameEquals("documentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + documentType = new HealthcareDocumentType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareActionContent( + loggingOptOut, + modelVersion, + stringIndexType, + fhirVersion, + documentType, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support writing '{options.Format}' format."); + } + } + + HealthcareActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionContent.cs new file mode 100644 index 000000000000..bafbb148835a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionContent.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Healthcare task. + public partial class HealthcareActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public HealthcareActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Specifies the method used to interpret string offsets. + /// The FHIR Spec version that the result will use to format the fhirBundle. For additional information see https://www.hl7.org/fhir/overview.html. + /// Document type that can be provided as input for Fhir Documents. Expect to have fhirVersion provided when used. Behavior of using None enum is the same as not using the documentType parameter. + /// Keeps track of any properties unknown to the library. + internal HealthcareActionContent(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType, FhirVersion? fhirVersion, HealthcareDocumentType? documentType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + StringIndexType = stringIndexType; + FhirVersion = fhirVersion; + DocumentType = documentType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + /// The FHIR Spec version that the result will use to format the fhirBundle. For additional information see https://www.hl7.org/fhir/overview.html. + public FhirVersion? FhirVersion { get; set; } + /// Document type that can be provided as input for Fhir Documents. Expect to have fhirVersion provided when used. Behavior of using None enum is the same as not using the documentType parameter. + public HealthcareDocumentType? DocumentType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionResult.Serialization.cs new file mode 100644 index 000000000000..c6ae852cba3a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionResult.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("relations"u8); + writer.WriteStartArray(); + foreach (var item in Relations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(FhirBundle)) + { + writer.WritePropertyName("fhirBundle"u8); + writer.WriteObjectValue(FhirBundle, options); + } + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareActionResult(document.RootElement, options); + } + + internal static HealthcareActionResult DeserializeHealthcareActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + IReadOnlyList relations = default; + FhirBundle fhirBundle = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntity.DeserializeHealthcareEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelation.DeserializeHealthcareRelation(item, options)); + } + relations = array; + continue; + } + if (property.NameEquals("fhirBundle"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fhirBundle = FhirBundle.DeserializeFhirBundle(property.Value, options); + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareActionResult( + id, + warnings, + statistics, + entities, + relations, + fhirBundle, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareActionResult)} does not support writing '{options.Format}' format."); + } + } + + HealthcareActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionResult.cs new file mode 100644 index 000000000000..8047ab258462 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareActionResult.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Result object for the processed Healthcare document with detected language. + public partial class HealthcareActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Healthcare entities. + /// Healthcare entity relations. + /// , , or is null. + internal HealthcareActionResult(string id, IEnumerable warnings, IEnumerable entities, IEnumerable relations) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + Argument.AssertNotNull(relations, nameof(relations)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + Relations = relations.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal HealthcareActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, IReadOnlyList relations, FhirBundle fhirBundle, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + Relations = relations; + FhirBundle = fhirBundle; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Healthcare entities. + public IReadOnlyList Entities { get; } + /// Healthcare entity relations. + public IReadOnlyList Relations { get; } + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + public FhirBundle FhirBundle { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertion.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertion.Serialization.cs new file mode 100644 index 000000000000..99c41d3588c0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertion.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareAssertion : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Conditionality)) + { + writer.WritePropertyName("conditionality"u8); + writer.WriteStringValue(Conditionality.Value.ToSerialString()); + } + if (Optional.IsDefined(Certainty)) + { + writer.WritePropertyName("certainty"u8); + writer.WriteStringValue(Certainty.Value.ToSerialString()); + } + if (Optional.IsDefined(Association)) + { + writer.WritePropertyName("association"u8); + writer.WriteStringValue(Association.Value.ToSerialString()); + } + if (Optional.IsDefined(Temporality)) + { + writer.WritePropertyName("temporality"u8); + writer.WriteStringValue(Temporality.Value.ToSerialString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareAssertion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareAssertion(document.RootElement, options); + } + + internal static HealthcareAssertion DeserializeHealthcareAssertion(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthcareAssertionConditionality? conditionality = default; + HealthcareAssertionCertainty? certainty = default; + HealthcareAssertionAssociation? association = default; + HealthcareAssertionTemporality? temporality = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conditionality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + conditionality = property.Value.GetString().ToHealthcareAssertionConditionality(); + continue; + } + if (property.NameEquals("certainty"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certainty = property.Value.GetString().ToHealthcareAssertionCertainty(); + continue; + } + if (property.NameEquals("association"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + association = property.Value.GetString().ToHealthcareAssertionAssociation(); + continue; + } + if (property.NameEquals("temporality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + temporality = property.Value.GetString().ToHealthcareAssertionTemporality(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareAssertion(conditionality, certainty, association, temporality, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support writing '{options.Format}' format."); + } + } + + HealthcareAssertion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareAssertion(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareAssertion FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareAssertion(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertion.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertion.cs new file mode 100644 index 000000000000..be301a455005 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertion.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Assertion of the entity. + public partial class HealthcareAssertion + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal HealthcareAssertion() + { + } + + /// Initializes a new instance of . + /// Describes any conditionality on the entity. + /// Describes the entities certainty and polarity. + /// Describes if the entity is the subject of the text or if it describes someone else. + /// Describes temporal information regarding the entity. + /// Keeps track of any properties unknown to the library. + internal HealthcareAssertion(HealthcareAssertionConditionality? conditionality, HealthcareAssertionCertainty? certainty, HealthcareAssertionAssociation? association, HealthcareAssertionTemporality? temporality, IDictionary serializedAdditionalRawData) + { + Conditionality = conditionality; + Certainty = certainty; + Association = association; + Temporality = temporality; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Describes any conditionality on the entity. + public HealthcareAssertionConditionality? Conditionality { get; } + /// Describes the entities certainty and polarity. + public HealthcareAssertionCertainty? Certainty { get; } + /// Describes if the entity is the subject of the text or if it describes someone else. + public HealthcareAssertionAssociation? Association { get; } + /// Describes temporal information regarding the entity. + public HealthcareAssertionTemporality? Temporality { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionAssociation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionAssociation.Serialization.cs new file mode 100644 index 000000000000..e4f448e141bd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionAssociation.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class HealthcareAssertionAssociationExtensions + { + public static string ToSerialString(this HealthcareAssertionAssociation value) => value switch + { + HealthcareAssertionAssociation.Subject => "subject", + HealthcareAssertionAssociation.Other => "other", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionAssociation value.") + }; + + public static HealthcareAssertionAssociation ToHealthcareAssertionAssociation(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "subject")) return HealthcareAssertionAssociation.Subject; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "other")) return HealthcareAssertionAssociation.Other; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionAssociation value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionAssociation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionAssociation.cs new file mode 100644 index 000000000000..00f566d29cc3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionAssociation.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// Describes if the entity is the subject of the text or if it describes someone else. + public enum HealthcareAssertionAssociation + { + /// Subject association. + Subject, + /// Other association. + Other + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionCertainty.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionCertainty.Serialization.cs new file mode 100644 index 000000000000..14838897400d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionCertainty.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class HealthcareAssertionCertaintyExtensions + { + public static string ToSerialString(this HealthcareAssertionCertainty value) => value switch + { + HealthcareAssertionCertainty.Positive => "positive", + HealthcareAssertionCertainty.PositivePossible => "positivePossible", + HealthcareAssertionCertainty.NeutralPossible => "neutralPossible", + HealthcareAssertionCertainty.NegativePossible => "negativePossible", + HealthcareAssertionCertainty.Negative => "negative", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionCertainty value.") + }; + + public static HealthcareAssertionCertainty ToHealthcareAssertionCertainty(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return HealthcareAssertionCertainty.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positivePossible")) return HealthcareAssertionCertainty.PositivePossible; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "neutralPossible")) return HealthcareAssertionCertainty.NeutralPossible; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negativePossible")) return HealthcareAssertionCertainty.NegativePossible; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return HealthcareAssertionCertainty.Negative; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionCertainty value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionCertainty.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionCertainty.cs new file mode 100644 index 000000000000..a3890fa10961 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionCertainty.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// Describes the entities certainty and polarity. + public enum HealthcareAssertionCertainty + { + /// Positive certainty. + Positive, + /// Possibly positive certainty. + PositivePossible, + /// Possibly neutral certainty. + NeutralPossible, + /// Possibly negative certainty. + NegativePossible, + /// Negative certainty. + Negative + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionConditionality.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionConditionality.Serialization.cs new file mode 100644 index 000000000000..509ce77406ed --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionConditionality.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class HealthcareAssertionConditionalityExtensions + { + public static string ToSerialString(this HealthcareAssertionConditionality value) => value switch + { + HealthcareAssertionConditionality.Hypothetical => "hypothetical", + HealthcareAssertionConditionality.Conditional => "conditional", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionConditionality value.") + }; + + public static HealthcareAssertionConditionality ToHealthcareAssertionConditionality(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "hypothetical")) return HealthcareAssertionConditionality.Hypothetical; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "conditional")) return HealthcareAssertionConditionality.Conditional; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionConditionality value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionConditionality.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionConditionality.cs new file mode 100644 index 000000000000..ce4ea74dcbd6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionConditionality.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// Describes any conditionality on the entity. + public enum HealthcareAssertionConditionality + { + /// Hypothetical conditionality. + Hypothetical, + /// Conditional conditionality. + Conditional + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionTemporality.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionTemporality.Serialization.cs new file mode 100644 index 000000000000..dd86a5890c45 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionTemporality.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class HealthcareAssertionTemporalityExtensions + { + public static string ToSerialString(this HealthcareAssertionTemporality value) => value switch + { + HealthcareAssertionTemporality.Current => "current", + HealthcareAssertionTemporality.Past => "past", + HealthcareAssertionTemporality.Future => "future", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionTemporality value.") + }; + + public static HealthcareAssertionTemporality ToHealthcareAssertionTemporality(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "current")) return HealthcareAssertionTemporality.Current; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "past")) return HealthcareAssertionTemporality.Past; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "future")) return HealthcareAssertionTemporality.Future; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionTemporality value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionTemporality.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionTemporality.cs new file mode 100644 index 000000000000..3df4eff2d5d0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareAssertionTemporality.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// Describes temporal information regarding the entity. + public enum HealthcareAssertionTemporality + { + /// Current temporality. + Current, + /// Past temporality. + Past, + /// Future temporality. + Future + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareDocumentType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareDocumentType.cs new file mode 100644 index 000000000000..0095fa72f956 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareDocumentType.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Document type. + public readonly partial struct HealthcareDocumentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HealthcareDocumentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ClinicalTrialValue = "ClinicalTrial"; + private const string DischargeSummaryValue = "DischargeSummary"; + private const string ProgressNoteValue = "ProgressNote"; + private const string HistoryAndPhysicalValue = "HistoryAndPhysical"; + private const string ConsultValue = "Consult"; + private const string ImagingValue = "Imaging"; + private const string PathologyValue = "Pathology"; + private const string ProcedureNoteValue = "ProcedureNote"; + + /// None document type. + public static HealthcareDocumentType None { get; } = new HealthcareDocumentType(NoneValue); + /// Clinical trial document type. + public static HealthcareDocumentType ClinicalTrial { get; } = new HealthcareDocumentType(ClinicalTrialValue); + /// Discharge summary document type. + public static HealthcareDocumentType DischargeSummary { get; } = new HealthcareDocumentType(DischargeSummaryValue); + /// Progress note document type. + public static HealthcareDocumentType ProgressNote { get; } = new HealthcareDocumentType(ProgressNoteValue); + /// History and physical document type. + public static HealthcareDocumentType HistoryAndPhysical { get; } = new HealthcareDocumentType(HistoryAndPhysicalValue); + /// Consult document type. + public static HealthcareDocumentType Consult { get; } = new HealthcareDocumentType(ConsultValue); + /// Imaging document type. + public static HealthcareDocumentType Imaging { get; } = new HealthcareDocumentType(ImagingValue); + /// Pathology document type. + public static HealthcareDocumentType Pathology { get; } = new HealthcareDocumentType(PathologyValue); + /// Procedure note document type. + public static HealthcareDocumentType ProcedureNote { get; } = new HealthcareDocumentType(ProcedureNoteValue); + /// Determines if two values are the same. + public static bool operator ==(HealthcareDocumentType left, HealthcareDocumentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HealthcareDocumentType left, HealthcareDocumentType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HealthcareDocumentType(string value) => new HealthcareDocumentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HealthcareDocumentType other && Equals(other); + /// + public bool Equals(HealthcareDocumentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntity.Serialization.cs new file mode 100644 index 000000000000..9195d636c17a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntity.Serialization.cs @@ -0,0 +1,246 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category.ToString()); + if (Optional.IsDefined(Subcategory)) + { + writer.WritePropertyName("subcategory"u8); + writer.WriteStringValue(Subcategory); + } + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (Optional.IsDefined(Assertion)) + { + writer.WritePropertyName("assertion"u8); + writer.WriteObjectValue(Assertion, options); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Links)) + { + writer.WritePropertyName("links"u8); + writer.WriteStartArray(); + foreach (var item in Links) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareEntity(document.RootElement, options); + } + + internal static HealthcareEntity DeserializeHealthcareEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + HealthcareEntityCategory category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + HealthcareAssertion assertion = default; + string name = default; + IReadOnlyList links = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = new HealthcareEntityCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("assertion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + assertion = HealthcareAssertion.DeserializeHealthcareAssertion(property.Value, options); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("links"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntityLink.DeserializeHealthcareEntityLink(item, options)); + } + links = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support writing '{options.Format}' format."); + } + } + + HealthcareEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntity.cs new file mode 100644 index 000000000000..3f77a2531937 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntity.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Healthcare entity extracted from the document. + public partial class HealthcareEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// is null. + internal HealthcareEntity(string text, HealthcareEntityCategory category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Links = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// Keeps track of any properties unknown to the library. + internal HealthcareEntity(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareAssertion assertion, string name, IReadOnlyList links, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Assertion = assertion; + Name = name; + Links = links; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Healthcare Entity Category. + public HealthcareEntityCategory Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + /// Assertion of the entity. + public HealthcareAssertion Assertion { get; } + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + public string Name { get; } + /// Entity references in known data sources. + public IReadOnlyList Links { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityCategory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityCategory.cs new file mode 100644 index 000000000000..02d62757ece2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityCategory.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Healthcare Entity Category. + public readonly partial struct HealthcareEntityCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HealthcareEntityCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BodyStructureValue = "BodyStructure"; + private const string AgeValue = "Age"; + private const string GenderValue = "Gender"; + private const string ExaminationNameValue = "ExaminationName"; + private const string DateValue = "Date"; + private const string DirectionValue = "Direction"; + private const string FrequencyValue = "Frequency"; + private const string MeasurementValueValue = "MeasurementValue"; + private const string MeasurementUnitValue = "MeasurementUnit"; + private const string RelationalOperatorValue = "RelationalOperator"; + private const string TimeValue = "Time"; + private const string GeneOrProteinValue = "GeneOrProtein"; + private const string VariantValue = "Variant"; + private const string AdministrativeEventValue = "AdministrativeEvent"; + private const string CareEnvironmentValue = "CareEnvironment"; + private const string HealthcareProfessionValue = "HealthcareProfession"; + private const string DiagnosisValue = "Diagnosis"; + private const string SymptomOrSignValue = "SymptomOrSign"; + private const string ConditionQualifierValue = "ConditionQualifier"; + private const string MedicationClassValue = "MedicationClass"; + private const string MedicationNameValue = "MedicationName"; + private const string DosageValue = "Dosage"; + private const string MedicationFormValue = "MedicationForm"; + private const string MedicationRouteValue = "MedicationRoute"; + private const string FamilyRelationValue = "FamilyRelation"; + private const string TreatmentNameValue = "TreatmentName"; + private const string EthnicityValue = "Ethnicity"; + private const string CourseValue = "Course"; + private const string ExpressionValue = "Expression"; + private const string MutationTypeValue = "MutationType"; + private const string ConditionScaleValue = "ConditionScale"; + private const string AllergenValue = "Allergen"; + private const string EmploymentValue = "Employment"; + private const string LivingStatusValue = "LivingStatus"; + private const string SubstanceUseValue = "SubstanceUse"; + private const string SubstanceUseAmountValue = "SubstanceUseAmount"; + + /// Body structure. + public static HealthcareEntityCategory BodyStructure { get; } = new HealthcareEntityCategory(BodyStructureValue); + /// Age. + public static HealthcareEntityCategory Age { get; } = new HealthcareEntityCategory(AgeValue); + /// Gender. + public static HealthcareEntityCategory Gender { get; } = new HealthcareEntityCategory(GenderValue); + /// Examination name. + public static HealthcareEntityCategory ExaminationName { get; } = new HealthcareEntityCategory(ExaminationNameValue); + /// Date. + public static HealthcareEntityCategory Date { get; } = new HealthcareEntityCategory(DateValue); + /// Direction. + public static HealthcareEntityCategory Direction { get; } = new HealthcareEntityCategory(DirectionValue); + /// Frequency. + public static HealthcareEntityCategory Frequency { get; } = new HealthcareEntityCategory(FrequencyValue); + /// Measurement value. + public static HealthcareEntityCategory MeasurementValue { get; } = new HealthcareEntityCategory(MeasurementValueValue); + /// Measurement unit. + public static HealthcareEntityCategory MeasurementUnit { get; } = new HealthcareEntityCategory(MeasurementUnitValue); + /// Relational operator. + public static HealthcareEntityCategory RelationalOperator { get; } = new HealthcareEntityCategory(RelationalOperatorValue); + /// Time. + public static HealthcareEntityCategory Time { get; } = new HealthcareEntityCategory(TimeValue); + /// Gene or protein. + public static HealthcareEntityCategory GeneOrProtein { get; } = new HealthcareEntityCategory(GeneOrProteinValue); + /// Variant. + public static HealthcareEntityCategory Variant { get; } = new HealthcareEntityCategory(VariantValue); + /// Administrative event. + public static HealthcareEntityCategory AdministrativeEvent { get; } = new HealthcareEntityCategory(AdministrativeEventValue); + /// Care environment. + public static HealthcareEntityCategory CareEnvironment { get; } = new HealthcareEntityCategory(CareEnvironmentValue); + /// Healthcare profession. + public static HealthcareEntityCategory HealthcareProfession { get; } = new HealthcareEntityCategory(HealthcareProfessionValue); + /// Diagnosis. + public static HealthcareEntityCategory Diagnosis { get; } = new HealthcareEntityCategory(DiagnosisValue); + /// Symptom or sign. + public static HealthcareEntityCategory SymptomOrSign { get; } = new HealthcareEntityCategory(SymptomOrSignValue); + /// Condition qualifier. + public static HealthcareEntityCategory ConditionQualifier { get; } = new HealthcareEntityCategory(ConditionQualifierValue); + /// Medication class. + public static HealthcareEntityCategory MedicationClass { get; } = new HealthcareEntityCategory(MedicationClassValue); + /// Medication name. + public static HealthcareEntityCategory MedicationName { get; } = new HealthcareEntityCategory(MedicationNameValue); + /// Dosage. + public static HealthcareEntityCategory Dosage { get; } = new HealthcareEntityCategory(DosageValue); + /// Medication form. + public static HealthcareEntityCategory MedicationForm { get; } = new HealthcareEntityCategory(MedicationFormValue); + /// Medication route. + public static HealthcareEntityCategory MedicationRoute { get; } = new HealthcareEntityCategory(MedicationRouteValue); + /// Family relation. + public static HealthcareEntityCategory FamilyRelation { get; } = new HealthcareEntityCategory(FamilyRelationValue); + /// Treatment name. + public static HealthcareEntityCategory TreatmentName { get; } = new HealthcareEntityCategory(TreatmentNameValue); + /// Ethnicity. + public static HealthcareEntityCategory Ethnicity { get; } = new HealthcareEntityCategory(EthnicityValue); + /// Course. + public static HealthcareEntityCategory Course { get; } = new HealthcareEntityCategory(CourseValue); + /// Expression. + public static HealthcareEntityCategory Expression { get; } = new HealthcareEntityCategory(ExpressionValue); + /// Mutation type. + public static HealthcareEntityCategory MutationType { get; } = new HealthcareEntityCategory(MutationTypeValue); + /// Condition scale. + public static HealthcareEntityCategory ConditionScale { get; } = new HealthcareEntityCategory(ConditionScaleValue); + /// Allergen. + public static HealthcareEntityCategory Allergen { get; } = new HealthcareEntityCategory(AllergenValue); + /// Employment. + public static HealthcareEntityCategory Employment { get; } = new HealthcareEntityCategory(EmploymentValue); + /// Living status. + public static HealthcareEntityCategory LivingStatus { get; } = new HealthcareEntityCategory(LivingStatusValue); + /// Substance use. + public static HealthcareEntityCategory SubstanceUse { get; } = new HealthcareEntityCategory(SubstanceUseValue); + /// Substance use amount. + public static HealthcareEntityCategory SubstanceUseAmount { get; } = new HealthcareEntityCategory(SubstanceUseAmountValue); + /// Determines if two values are the same. + public static bool operator ==(HealthcareEntityCategory left, HealthcareEntityCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HealthcareEntityCategory left, HealthcareEntityCategory right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HealthcareEntityCategory(string value) => new HealthcareEntityCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HealthcareEntityCategory other && Equals(other); + /// + public bool Equals(HealthcareEntityCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityLink.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityLink.Serialization.cs new file mode 100644 index 000000000000..f44ec63cad1a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityLink.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareEntityLink : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("dataSource"u8); + writer.WriteStringValue(DataSource); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareEntityLink IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareEntityLink(document.RootElement, options); + } + + internal static HealthcareEntityLink DeserializeHealthcareEntityLink(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string dataSource = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataSource"u8)) + { + dataSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareEntityLink(dataSource, id, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support writing '{options.Format}' format."); + } + } + + HealthcareEntityLink IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareEntityLink(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareEntityLink FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareEntityLink(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityLink.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityLink.cs new file mode 100644 index 000000000000..b534dd51f592 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareEntityLink.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Reference to an entity in known data sources. + public partial class HealthcareEntityLink + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + /// Entity id in the given source catalog. + /// or is null. + internal HealthcareEntityLink(string dataSource, string id) + { + Argument.AssertNotNull(dataSource, nameof(dataSource)); + Argument.AssertNotNull(id, nameof(id)); + + DataSource = dataSource; + Id = id; + } + + /// Initializes a new instance of . + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + /// Entity id in the given source catalog. + /// Keeps track of any properties unknown to the library. + internal HealthcareEntityLink(string dataSource, string id, IDictionary serializedAdditionalRawData) + { + DataSource = dataSource; + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareEntityLink() + { + } + + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + public string DataSource { get; } + /// Entity id in the given source catalog. + public string Id { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationAction.Serialization.cs new file mode 100644 index 000000000000..ed6a0106f855 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + HealthcareOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareOperationAction(document.RootElement, options); + } + + internal static HealthcareOperationAction DeserializeHealthcareOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthcareActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = HealthcareActionContent.DeserializeHealthcareActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support writing '{options.Format}' format."); + } + } + + HealthcareOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new HealthcareOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationAction.cs new file mode 100644 index 000000000000..c83411e9773d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The long running task to be performed by the service on the Healthcare input documents. + public partial class HealthcareOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public HealthcareOperationAction() + { + Kind = AnalyzeTextOperationActionKind.Healthcare; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Healthcare task. + internal HealthcareOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, HealthcareActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Healthcare task. + public HealthcareActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationResult.Serialization.cs new file mode 100644 index 000000000000..6f7ac10131b9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + HealthcareOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareOperationResult(document.RootElement, options); + } + + internal static HealthcareOperationResult DeserializeHealthcareOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthcareResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = HealthcareResult.DeserializeHealthcareResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support writing '{options.Format}' format."); + } + } + + HealthcareOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new HealthcareOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationResult.cs new file mode 100644 index 000000000000..6f6cfdd34473 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Healthcare Analyze Text long tunning operation result object. + public partial class HealthcareOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal HealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, HealthcareResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.HealthcareOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal HealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, HealthcareResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareOperationResult() + { + } + + /// Results of the task. + public HealthcareResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelation.Serialization.cs new file mode 100644 index 000000000000..e0f644cfd816 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelation.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareRelation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("relationType"u8); + writer.WriteStringValue(RelationType.ToString()); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(ConfidenceScore)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareRelation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareRelation(document.RootElement, options); + } + + internal static HealthcareRelation DeserializeHealthcareRelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RelationType relationType = default; + IReadOnlyList entities = default; + double? confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("relationType"u8)) + { + relationType = new RelationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelationEntity.DeserializeHealthcareRelationEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareRelation(relationType, entities, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support writing '{options.Format}' format."); + } + } + + HealthcareRelation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareRelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareRelation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareRelation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelation.cs new file mode 100644 index 000000000000..54a9596f149a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelation.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Every relation is an entity graph of a certain relationType, where all entities are connected and have specific roles within the relation context. + public partial class HealthcareRelation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + /// The entities in the relation. + /// is null. + internal HealthcareRelation(RelationType relationType, IEnumerable entities) + { + Argument.AssertNotNull(entities, nameof(entities)); + + RelationType = relationType; + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + /// The entities in the relation. + /// Confidence score between 0 and 1 of the extracted relation. + /// Keeps track of any properties unknown to the library. + internal HealthcareRelation(RelationType relationType, IReadOnlyList entities, double? confidenceScore, IDictionary serializedAdditionalRawData) + { + RelationType = relationType; + Entities = entities; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareRelation() + { + } + + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + public RelationType RelationType { get; } + /// The entities in the relation. + public IReadOnlyList Entities { get; } + /// Confidence score between 0 and 1 of the extracted relation. + public double? ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelationEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelationEntity.Serialization.cs new file mode 100644 index 000000000000..ae9f0b081dce --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelationEntity.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareRelationEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("ref"u8); + writer.WriteStringValue(Ref); + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareRelationEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareRelationEntity(document.RootElement, options); + } + + internal static HealthcareRelationEntity DeserializeHealthcareRelationEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @ref = default; + string role = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ref"u8)) + { + @ref = property.Value.GetString(); + continue; + } + if (property.NameEquals("role"u8)) + { + role = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareRelationEntity(@ref, role, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support writing '{options.Format}' format."); + } + } + + HealthcareRelationEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareRelationEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareRelationEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareRelationEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelationEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelationEntity.cs new file mode 100644 index 000000000000..88173c9a4cbb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareRelationEntity.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Entity in the relation. + public partial class HealthcareRelationEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + /// or is null. + internal HealthcareRelationEntity(string @ref, string role) + { + Argument.AssertNotNull(@ref, nameof(@ref)); + Argument.AssertNotNull(role, nameof(role)); + + Ref = @ref; + Role = role; + } + + /// Initializes a new instance of . + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + /// Keeps track of any properties unknown to the library. + internal HealthcareRelationEntity(string @ref, string role, IDictionary serializedAdditionalRawData) + { + Ref = @ref; + Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareRelationEntity() + { + } + + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + public string Ref { get; } + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + public string Role { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareResult.Serialization.cs new file mode 100644 index 000000000000..69b8da9c024e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class HealthcareResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthcareResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareResult(document.RootElement, options); + } + + internal static HealthcareResult DeserializeHealthcareResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareActionResult.DeserializeHealthcareActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareResult)} does not support writing '{options.Format}' format."); + } + } + + HealthcareResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareResult.cs new file mode 100644 index 000000000000..c21ba999d64c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/HealthcareResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Result object for the processed Healthcare task. + public partial class HealthcareResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// List of result objects for the processed Healthcare documents. + /// , or is null. + internal HealthcareResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// List of result objects for the processed Healthcare documents. + /// Keeps track of any properties unknown to the library. + internal HealthcareResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// List of result objects for the processed Healthcare documents. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationMetadata.Serialization.cs new file mode 100644 index 000000000000..94f9e946af3d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class InformationMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InformationMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + InformationMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InformationMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInformationMetadata(document.RootElement, options); + } + + internal static InformationMetadata DeserializeInformationMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + InformationUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new InformationUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InformationMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InformationMetadata)} does not support writing '{options.Format}' format."); + } + } + + InformationMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInformationMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InformationMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new InformationMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInformationMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationMetadata.cs new file mode 100644 index 000000000000..5ca61684dd88 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Information (data) entity Metadata model. + public partial class InformationMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for information. + internal InformationMetadata(double value, InformationUnit unit) + { + MetadataKind = MetadataKind.InformationMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for information. + internal InformationMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, InformationUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal InformationMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for information. + public InformationUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationUnit.cs new file mode 100644 index 000000000000..77b9841ddb82 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InformationUnit.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The information (data) Unit of measurement. + public readonly partial struct InformationUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InformationUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string BitValue = "Bit"; + private const string KilobitValue = "Kilobit"; + private const string MegabitValue = "Megabit"; + private const string GigabitValue = "Gigabit"; + private const string TerabitValue = "Terabit"; + private const string PetabitValue = "Petabit"; + private const string ByteValue = "Byte"; + private const string KilobyteValue = "Kilobyte"; + private const string MegabyteValue = "Megabyte"; + private const string GigabyteValue = "Gigabyte"; + private const string TerabyteValue = "Terabyte"; + private const string PetabyteValue = "Petabyte"; + + /// Unspecified data size unit. + public static InformationUnit Unspecified { get; } = new InformationUnit(UnspecifiedValue); + /// Data size unit in bits. + public static InformationUnit Bit { get; } = new InformationUnit(BitValue); + /// Data size unit in kilobits. + public static InformationUnit Kilobit { get; } = new InformationUnit(KilobitValue); + /// Data size unit in megabits. + public static InformationUnit Megabit { get; } = new InformationUnit(MegabitValue); + /// Data size unit in gigabits. + public static InformationUnit Gigabit { get; } = new InformationUnit(GigabitValue); + /// Data size unit in terabits. + public static InformationUnit Terabit { get; } = new InformationUnit(TerabitValue); + /// Data size unit in petabits. + public static InformationUnit Petabit { get; } = new InformationUnit(PetabitValue); + /// Data size unit in bytes. + public static InformationUnit Byte { get; } = new InformationUnit(ByteValue); + /// Data size unit in kilobytes. + public static InformationUnit Kilobyte { get; } = new InformationUnit(KilobyteValue); + /// Data size unit in megabytes. + public static InformationUnit Megabyte { get; } = new InformationUnit(MegabyteValue); + /// Data size unit in gigabytes. + public static InformationUnit Gigabyte { get; } = new InformationUnit(GigabyteValue); + /// Data size unit in terabytes. + public static InformationUnit Terabyte { get; } = new InformationUnit(TerabyteValue); + /// Data size unit in petabytes. + public static InformationUnit Petabyte { get; } = new InformationUnit(PetabyteValue); + /// Determines if two values are the same. + public static bool operator ==(InformationUnit left, InformationUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InformationUnit left, InformationUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InformationUnit(string value) => new InformationUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InformationUnit other && Equals(other); + /// + public bool Equals(InformationUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorCode.cs new file mode 100644 index 000000000000..ae6b289afea5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorCode.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Human-readable error code. + public readonly partial struct InnerErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InnerErrorCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidRequestValue = "InvalidRequest"; + private const string InvalidParameterValueValue = "InvalidParameterValue"; + private const string KnowledgeBaseNotFoundValue = "KnowledgeBaseNotFound"; + private const string AzureCognitiveSearchNotFoundValue = "AzureCognitiveSearchNotFound"; + private const string AzureCognitiveSearchThrottlingValue = "AzureCognitiveSearchThrottling"; + private const string ExtractionFailureValue = "ExtractionFailure"; + private const string InvalidRequestBodyFormatValue = "InvalidRequestBodyFormat"; + private const string EmptyRequestValue = "EmptyRequest"; + private const string MissingInputDocumentsValue = "MissingInputDocuments"; + private const string InvalidDocumentValue = "InvalidDocument"; + private const string ModelVersionIncorrectValue = "ModelVersionIncorrect"; + private const string InvalidDocumentBatchValue = "InvalidDocumentBatch"; + private const string UnsupportedLanguageCodeValue = "UnsupportedLanguageCode"; + private const string InvalidCountryHintValue = "InvalidCountryHint"; + + /// Invalid request error. + public static InnerErrorCode InvalidRequest { get; } = new InnerErrorCode(InvalidRequestValue); + /// Invalid parameter value error. + public static InnerErrorCode InvalidParameterValue { get; } = new InnerErrorCode(InvalidParameterValueValue); + /// Knowledge base not found error. + public static InnerErrorCode KnowledgeBaseNotFound { get; } = new InnerErrorCode(KnowledgeBaseNotFoundValue); + /// Azure Cognitive Search not found error. + public static InnerErrorCode AzureCognitiveSearchNotFound { get; } = new InnerErrorCode(AzureCognitiveSearchNotFoundValue); + /// Azure Cognitive Search throttling error. + public static InnerErrorCode AzureCognitiveSearchThrottling { get; } = new InnerErrorCode(AzureCognitiveSearchThrottlingValue); + /// Extraction failure error. + public static InnerErrorCode ExtractionFailure { get; } = new InnerErrorCode(ExtractionFailureValue); + /// Invalid request body format error. + public static InnerErrorCode InvalidRequestBodyFormat { get; } = new InnerErrorCode(InvalidRequestBodyFormatValue); + /// Empty request error. + public static InnerErrorCode EmptyRequest { get; } = new InnerErrorCode(EmptyRequestValue); + /// Missing input documents error. + public static InnerErrorCode MissingInputDocuments { get; } = new InnerErrorCode(MissingInputDocumentsValue); + /// Invalid document error. + public static InnerErrorCode InvalidDocument { get; } = new InnerErrorCode(InvalidDocumentValue); + /// Model version incorrect error. + public static InnerErrorCode ModelVersionIncorrect { get; } = new InnerErrorCode(ModelVersionIncorrectValue); + /// Invalid document batch error. + public static InnerErrorCode InvalidDocumentBatch { get; } = new InnerErrorCode(InvalidDocumentBatchValue); + /// Unsupported language code error. + public static InnerErrorCode UnsupportedLanguageCode { get; } = new InnerErrorCode(UnsupportedLanguageCodeValue); + /// Invalid country hint error. + public static InnerErrorCode InvalidCountryHint { get; } = new InnerErrorCode(InvalidCountryHintValue); + /// Determines if two values are the same. + public static bool operator ==(InnerErrorCode left, InnerErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InnerErrorCode left, InnerErrorCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InnerErrorCode(string value) => new InnerErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InnerErrorCode other && Equals(other); + /// + public bool Equals(InnerErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorModel.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorModel.Serialization.cs new file mode 100644 index 000000000000..c28bd6f5b27b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorModel.Serialization.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class InnerErrorModel : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartObject(); + foreach (var item in Details) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsDefined(Innererror)) + { + writer.WritePropertyName("innererror"u8); + writer.WriteObjectValue(Innererror, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InnerErrorModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInnerErrorModel(document.RootElement, options); + } + + internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InnerErrorCode code = default; + string message = default; + IReadOnlyDictionary details = default; + string target = default; + InnerErrorModel innererror = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new InnerErrorCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + details = dictionary; + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("innererror"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + innererror = DeserializeInnerErrorModel(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InnerErrorModel( + code, + message, + details ?? new ChangeTrackingDictionary(), + target, + innererror, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support writing '{options.Format}' format."); + } + } + + InnerErrorModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInnerErrorModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InnerErrorModel FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInnerErrorModel(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorModel.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorModel.cs new file mode 100644 index 000000000000..a8a409819936 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/InnerErrorModel.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + public partial class InnerErrorModel + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// Error message. + /// is null. + internal InnerErrorModel(InnerErrorCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + Details = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// Error message. + /// Error details. + /// Error target. + /// An object containing more specific information than the current object about the error. + /// Keeps track of any properties unknown to the library. + internal InnerErrorModel(InnerErrorCode code, string message, IReadOnlyDictionary details, string target, InnerErrorModel innererror, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Details = details; + Target = target; + Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InnerErrorModel() + { + } + + /// One of a server-defined set of error codes. + public InnerErrorCode Code { get; } + /// Error message. + public string Message { get; } + /// Error details. + public IReadOnlyDictionary Details { get; } + /// Error target. + public string Target { get; } + /// An object containing more specific information than the current object about the error. + public InnerErrorModel Innererror { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..461b11edcbb4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..68b4eee0cd79 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..9843778a0bf0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..c91db17b0d98 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..9e68d3016ecc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.AI.Language.Text +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..663cee94ac18 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseActionContent.Serialization.cs new file mode 100644 index 000000000000..3fd0e8e01a6e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseActionContent.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class KeyPhraseActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyPhraseActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseActionContent(document.RootElement, options); + } + + internal static KeyPhraseActionContent DeserializeKeyPhraseActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseActionContent(loggingOptOut, modelVersion, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static KeyPhraseActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseActionContent.cs new file mode 100644 index 000000000000..4871fb8352de --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseActionContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Key Phrase Extraction task. + public partial class KeyPhraseActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public KeyPhraseActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Keeps track of any properties unknown to the library. + internal KeyPhraseActionContent(bool? loggingOptOut, string modelVersion, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseExtractionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseExtractionOperationResult.Serialization.cs new file mode 100644 index 000000000000..83b7cd426723 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseExtractionOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class KeyPhraseExtractionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + KeyPhraseExtractionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseExtractionOperationResult(document.RootElement, options); + } + + internal static KeyPhraseExtractionOperationResult DeserializeKeyPhraseExtractionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyPhraseResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = KeyPhraseResult.DeserializeKeyPhraseResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseExtractionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseExtractionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseExtractionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new KeyPhraseExtractionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseExtractionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseExtractionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseExtractionOperationResult.cs new file mode 100644 index 000000000000..42053473b3b0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseExtractionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text KeyPhraseExtraction LRO task. + public partial class KeyPhraseExtractionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// The list of Key phrase extraction results. + /// is null. + internal KeyPhraseExtractionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, KeyPhraseResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.KeyPhraseExtractionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// The list of Key phrase extraction results. + internal KeyPhraseExtractionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, KeyPhraseResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal KeyPhraseExtractionOperationResult() + { + } + + /// The list of Key phrase extraction results. + public KeyPhraseResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseOperationAction.Serialization.cs new file mode 100644 index 000000000000..b83dd951e1ff --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class KeyPhraseOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + KeyPhraseOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseOperationAction(document.RootElement, options); + } + + internal static KeyPhraseOperationAction DeserializeKeyPhraseOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyPhraseActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = KeyPhraseActionContent.DeserializeKeyPhraseActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new KeyPhraseOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseOperationAction.cs new file mode 100644 index 000000000000..fa515f4133f9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the task definition for a Key Phrase Extraction task. + public partial class KeyPhraseOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public KeyPhraseOperationAction() + { + Kind = AnalyzeTextOperationActionKind.KeyPhraseExtraction; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Key phrase extraction task parameters. + internal KeyPhraseOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, KeyPhraseActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Key phrase extraction task parameters. + public KeyPhraseActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseResult.Serialization.cs new file mode 100644 index 000000000000..a7cc29da73a5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class KeyPhraseResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyPhraseResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseResult(document.RootElement, options); + } + + internal static KeyPhraseResult DeserializeKeyPhraseResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KeyPhrasesActionResult.DeserializeKeyPhrasesActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static KeyPhraseResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseResult.cs new file mode 100644 index 000000000000..b7e825436733 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhraseResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the KeyPhraseResult. + public partial class KeyPhraseResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal KeyPhraseResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal KeyPhraseResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyPhraseResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhrasesActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhrasesActionResult.Serialization.cs new file mode 100644 index 000000000000..9d0c1ab06ef0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhrasesActionResult.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class KeyPhrasesActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhrasesActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("keyPhrases"u8); + writer.WriteStartArray(); + foreach (var item in KeyPhrases) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyPhrasesActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhrasesActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhrasesActionResult(document.RootElement, options); + } + + internal static KeyPhrasesActionResult DeserializeKeyPhrasesActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList keyPhrases = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("keyPhrases"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + keyPhrases = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhrasesActionResult( + id, + warnings, + statistics, + keyPhrases, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhrasesActionResult)} does not support writing '{options.Format}' format."); + } + } + + KeyPhrasesActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhrasesActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhrasesActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static KeyPhrasesActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhrasesActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhrasesActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhrasesActionResult.cs new file mode 100644 index 000000000000..6e40f4552f48 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/KeyPhrasesActionResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// A ranked list of sentences representing the extracted summary. + public partial class KeyPhrasesActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + /// , or is null. + internal KeyPhrasesActionResult(string id, IEnumerable warnings, IEnumerable keyPhrases) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(keyPhrases, nameof(keyPhrases)); + + Id = id; + Warnings = warnings.ToList(); + KeyPhrases = keyPhrases.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal KeyPhrasesActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList keyPhrases, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + KeyPhrases = keyPhrases; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyPhrasesActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + public IReadOnlyList KeyPhrases { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionActionContent.Serialization.cs new file mode 100644 index 000000000000..fad18fed7bc3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionActionContent.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LanguageDetectionActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LanguageDetectionActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionActionContent(document.RootElement, options); + } + + internal static LanguageDetectionActionContent DeserializeLanguageDetectionActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionActionContent(loggingOptOut, modelVersion, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionActionContent.cs new file mode 100644 index 000000000000..f90ba1b66f53 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionActionContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Language Detection task. + public partial class LanguageDetectionActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LanguageDetectionActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionActionContent(bool? loggingOptOut, string modelVersion, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionDocumentResult.Serialization.cs new file mode 100644 index 000000000000..c5ed0a7618cc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionDocumentResult.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LanguageDetectionDocumentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LanguageDetectionDocumentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionDocumentResult(document.RootElement, options); + } + + internal static LanguageDetectionDocumentResult DeserializeLanguageDetectionDocumentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionDocumentResult(id, warnings, statistics, detectedLanguage, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionDocumentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionDocumentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionDocumentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionDocumentResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionDocumentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionDocumentResult.cs new file mode 100644 index 000000000000..902c2305bfd0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionDocumentResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the language detection for a document. + public partial class LanguageDetectionDocumentResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Detected Language. + /// , or is null. + internal LanguageDetectionDocumentResult(string id, IEnumerable warnings, DetectedLanguage detectedLanguage) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(detectedLanguage, nameof(detectedLanguage)); + + Id = id; + Warnings = warnings.ToList(); + DetectedLanguage = detectedLanguage; + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Detected Language. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionDocumentResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LanguageDetectionDocumentResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Detected Language. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionResult.Serialization.cs new file mode 100644 index 000000000000..565dc55e4ead --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LanguageDetectionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LanguageDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionResult(document.RootElement, options); + } + + internal static LanguageDetectionResult DeserializeLanguageDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LanguageDetectionDocumentResult.DeserializeLanguageDetectionDocumentResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionResult.cs new file mode 100644 index 000000000000..20c8858529a1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the language detection result for the request. + public partial class LanguageDetectionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Enumeration of language detection results for each input document. + /// , or is null. + internal LanguageDetectionResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Enumeration of language detection results for each input document. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LanguageDetectionResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Enumeration of language detection results for each input document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionTextInput.Serialization.cs new file mode 100644 index 000000000000..f3dc0ff0ad2f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionTextInput.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LanguageDetectionTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(LanguageInputs)) + { + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in LanguageInputs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LanguageDetectionTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionTextInput(document.RootElement, options); + } + + internal static LanguageDetectionTextInput DeserializeLanguageDetectionTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LanguageInput.DeserializeLanguageInput(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionTextInput(documents ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionTextInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionTextInput.cs new file mode 100644 index 000000000000..a86f7f236663 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageDetectionTextInput.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the language detection document analysis input. + public partial class LanguageDetectionTextInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LanguageDetectionTextInput() + { + LanguageInputs = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of documents to be analyzed. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionTextInput(IList languageInputs, IDictionary serializedAdditionalRawData) + { + LanguageInputs = languageInputs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of documents to be analyzed. + public IList LanguageInputs { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageInput.Serialization.cs new file mode 100644 index 000000000000..77cc49a7c710 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageInput.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LanguageInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageInput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (Optional.IsDefined(CountryHint)) + { + writer.WritePropertyName("countryHint"u8); + writer.WriteStringValue(CountryHint); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LanguageInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageInput(document.RootElement, options); + } + + internal static LanguageInput DeserializeLanguageInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string text = default; + string countryHint = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryHint"u8)) + { + countryHint = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageInput(id, text, countryHint, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageInput)} does not support writing '{options.Format}' format."); + } + } + + LanguageInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageInput.cs new file mode 100644 index 000000000000..bb18b1d8f294 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LanguageInput.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the language detection input. + public partial class LanguageInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// or is null. + public LanguageInput(string id, string text) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(text, nameof(text)); + + Id = id; + Text = text; + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// The country hint to help with language detection of the text. + /// Keeps track of any properties unknown to the library. + internal LanguageInput(string id, string text, string countryHint, IDictionary serializedAdditionalRawData) + { + Id = id; + Text = text; + CountryHint = countryHint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LanguageInput() + { + } + + /// A unique, non-empty document identifier. + public string Id { get; } + /// The input text to process. + public string Text { get; } + /// The country hint to help with language detection of the text. + public string CountryHint { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LearnedComponent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LearnedComponent.Serialization.cs new file mode 100644 index 000000000000..13f35d298ae2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LearnedComponent.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LearnedComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LearnedComponent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + } + + LearnedComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LearnedComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLearnedComponent(document.RootElement, options); + } + + internal static LearnedComponent DeserializeLearnedComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + EntityComponentKind entityComponentKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LearnedComponent(entityComponentKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LearnedComponent)} does not support writing '{options.Format}' format."); + } + } + + LearnedComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLearnedComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LearnedComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LearnedComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLearnedComponent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LearnedComponent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LearnedComponent.cs new file mode 100644 index 000000000000..b4309c19fe53 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LearnedComponent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// This object contains information of the learned component of the detected entity. + public partial class LearnedComponent : EntityComponentInformation + { + /// Initializes a new instance of . + internal LearnedComponent() + { + EntityComponentKind = EntityComponentKind.LearnedComponent; + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + /// The learned component of an extracted entity type. + internal LearnedComponent(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData, string value) : base(entityComponentKind, serializedAdditionalRawData) + { + Value = value; + } + + /// The learned component of an extracted entity type. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthMetadata.Serialization.cs new file mode 100644 index 000000000000..a3b33d29d562 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LengthMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LengthMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + LengthMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LengthMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLengthMetadata(document.RootElement, options); + } + + internal static LengthMetadata DeserializeLengthMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + LengthUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new LengthUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LengthMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LengthMetadata)} does not support writing '{options.Format}' format."); + } + } + + LengthMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLengthMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LengthMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LengthMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLengthMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthMetadata.cs new file mode 100644 index 000000000000..76734a805dd4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Length entity Metadata model. + public partial class LengthMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for length. + internal LengthMetadata(double value, LengthUnit unit) + { + MetadataKind = MetadataKind.LengthMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for length. + internal LengthMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, LengthUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal LengthMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for length. + public LengthUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthUnit.cs new file mode 100644 index 000000000000..0384b22720de --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LengthUnit.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The length unit of measurement. + public readonly partial struct LengthUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LengthUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string KilometerValue = "Kilometer"; + private const string HectometerValue = "Hectometer"; + private const string DecameterValue = "Decameter"; + private const string MeterValue = "Meter"; + private const string DecimeterValue = "Decimeter"; + private const string CentimeterValue = "Centimeter"; + private const string MillimeterValue = "Millimeter"; + private const string MicrometerValue = "Micrometer"; + private const string NanometerValue = "Nanometer"; + private const string PicometerValue = "Picometer"; + private const string MileValue = "Mile"; + private const string YardValue = "Yard"; + private const string InchValue = "Inch"; + private const string FootValue = "Foot"; + private const string LightYearValue = "LightYear"; + private const string PointValue = "Point"; + + /// Unspecified length unit. + public static LengthUnit Unspecified { get; } = new LengthUnit(UnspecifiedValue); + /// Length unit in kilometers. + public static LengthUnit Kilometer { get; } = new LengthUnit(KilometerValue); + /// Length unit in hectometers. + public static LengthUnit Hectometer { get; } = new LengthUnit(HectometerValue); + /// Length unit in decameters. + public static LengthUnit Decameter { get; } = new LengthUnit(DecameterValue); + /// Length unit in meters. + public static LengthUnit Meter { get; } = new LengthUnit(MeterValue); + /// Length unit in decimeters. + public static LengthUnit Decimeter { get; } = new LengthUnit(DecimeterValue); + /// Length unit in centimeters. + public static LengthUnit Centimeter { get; } = new LengthUnit(CentimeterValue); + /// Length unit in millimeters. + public static LengthUnit Millimeter { get; } = new LengthUnit(MillimeterValue); + /// Length unit in micrometers. + public static LengthUnit Micrometer { get; } = new LengthUnit(MicrometerValue); + /// Length unit in nanometers. + public static LengthUnit Nanometer { get; } = new LengthUnit(NanometerValue); + /// Length unit in picometers. + public static LengthUnit Picometer { get; } = new LengthUnit(PicometerValue); + /// Length unit in miles. + public static LengthUnit Mile { get; } = new LengthUnit(MileValue); + /// Length unit in yards. + public static LengthUnit Yard { get; } = new LengthUnit(YardValue); + /// Length unit in inches. + public static LengthUnit Inch { get; } = new LengthUnit(InchValue); + /// Length unit in feet. + public static LengthUnit Foot { get; } = new LengthUnit(FootValue); + /// Length unit in light years. + public static LengthUnit LightYear { get; } = new LengthUnit(LightYearValue); + /// Length unit in points. + public static LengthUnit Point { get; } = new LengthUnit(PointValue); + /// Determines if two values are the same. + public static bool operator ==(LengthUnit left, LengthUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LengthUnit left, LengthUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LengthUnit(string value) => new LengthUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LengthUnit other && Equals(other); + /// + public bool Equals(LengthUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LinkedEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LinkedEntity.Serialization.cs new file mode 100644 index 000000000000..137c938e625b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LinkedEntity.Serialization.cs @@ -0,0 +1,214 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class LinkedEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LinkedEntity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("matches"u8); + writer.WriteStartArray(); + foreach (var item in Matches) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url); + writer.WritePropertyName("dataSource"u8); + writer.WriteStringValue(DataSource); + if (Optional.IsDefined(BingId)) + { + writer.WritePropertyName("bingId"u8); + writer.WriteStringValue(BingId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LinkedEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LinkedEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedEntity(document.RootElement, options); + } + + internal static LinkedEntity DeserializeLinkedEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IReadOnlyList matches = default; + string language = default; + string id = default; + string url = default; + string dataSource = default; + string bingId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("matches"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityLinkingMatch.DeserializeEntityLinkingMatch(item, options)); + } + matches = array; + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("url"u8)) + { + url = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataSource"u8)) + { + dataSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("bingId"u8)) + { + bingId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LinkedEntity( + name, + matches, + language, + id, + url, + dataSource, + bingId, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LinkedEntity)} does not support writing '{options.Format}' format."); + } + } + + LinkedEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLinkedEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LinkedEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LinkedEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLinkedEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LinkedEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LinkedEntity.cs new file mode 100644 index 000000000000..e84fa1b5070b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/LinkedEntity.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// The LinkedEntity object containing the detected entity with the associated sources/links. + public partial class LinkedEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity Linking formal name. + /// List of instances this entity appears in the text. + /// Language used in the data source. + /// URL for the entity's page from the data source. + /// Data source used to extract entity linking, such as Wiki/Bing etc. + /// , , , or is null. + internal LinkedEntity(string name, IEnumerable matches, string language, string url, string dataSource) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(matches, nameof(matches)); + Argument.AssertNotNull(language, nameof(language)); + Argument.AssertNotNull(url, nameof(url)); + Argument.AssertNotNull(dataSource, nameof(dataSource)); + + Name = name; + Matches = matches.ToList(); + Language = language; + Url = url; + DataSource = dataSource; + } + + /// Initializes a new instance of . + /// Entity Linking formal name. + /// List of instances this entity appears in the text. + /// Language used in the data source. + /// Unique identifier of the recognized entity from the data source. + /// URL for the entity's page from the data source. + /// Data source used to extract entity linking, such as Wiki/Bing etc. + /// Bing Entity Search API unique identifier of the recognized entity. + /// Keeps track of any properties unknown to the library. + internal LinkedEntity(string name, IReadOnlyList matches, string language, string id, string url, string dataSource, string bingId, IDictionary serializedAdditionalRawData) + { + Name = name; + Matches = matches; + Language = language; + Id = id; + Url = url; + DataSource = dataSource; + BingId = bingId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LinkedEntity() + { + } + + /// Entity Linking formal name. + public string Name { get; } + /// List of instances this entity appears in the text. + public IReadOnlyList Matches { get; } + /// Language used in the data source. + public string Language { get; } + /// Unique identifier of the recognized entity from the data source. + public string Id { get; } + /// URL for the entity's page from the data source. + public string Url { get; } + /// Data source used to extract entity linking, such as Wiki/Bing etc. + public string DataSource { get; } + /// Bing Entity Search API unique identifier of the recognized entity. + public string BingId { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ListComponent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ListComponent.Serialization.cs new file mode 100644 index 000000000000..ee0ac06a51de --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ListComponent.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class ListComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListComponent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + } + + ListComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListComponent(document.RootElement, options); + } + + internal static ListComponent DeserializeListComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + EntityComponentKind entityComponentKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ListComponent(entityComponentKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ListComponent)} does not support writing '{options.Format}' format."); + } + } + + ListComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeListComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ListComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeListComponent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ListComponent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ListComponent.cs new file mode 100644 index 000000000000..d6f13e89e85e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ListComponent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// This object contains information of the list component of the detected entity. + public partial class ListComponent : EntityComponentInformation + { + /// Initializes a new instance of . + internal ListComponent() + { + EntityComponentKind = EntityComponentKind.ListComponent; + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + /// The list key of an extracted entity type. + internal ListComponent(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData, string value) : base(entityComponentKind, serializedAdditionalRawData) + { + Value = value; + } + + /// The list key of an extracted entity type. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MatchLongestEntityPolicyType.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MatchLongestEntityPolicyType.Serialization.cs new file mode 100644 index 000000000000..837e35db75db --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MatchLongestEntityPolicyType.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class MatchLongestEntityPolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + MatchLongestEntityPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMatchLongestEntityPolicyType(document.RootElement, options); + } + + internal static MatchLongestEntityPolicyType DeserializeMatchLongestEntityPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new PolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MatchLongestEntityPolicyType(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support writing '{options.Format}' format."); + } + } + + MatchLongestEntityPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMatchLongestEntityPolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MatchLongestEntityPolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMatchLongestEntityPolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MatchLongestEntityPolicyType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MatchLongestEntityPolicyType.cs new file mode 100644 index 000000000000..523d6c2c5d4f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MatchLongestEntityPolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Match longest overlap policy. No overlapping entities as far as it is possible. 1. If there are overlapping entities, the longest one will be returned. 2. If the set of characters predicted for 2 or more entities are exactly the same, select the entity that has the higher confidence score.3. If the entity scores are identical, return all entities that are still present after applying the previous rules. 3. If there is partial overlap (as in Hello Text Analytics) follow the above steps starting from 1. + public partial class MatchLongestEntityPolicyType : EntityOverlapPolicy + { + /// Initializes a new instance of . + public MatchLongestEntityPolicyType() + { + PolicyKind = PolicyKind.MatchLongest; + } + + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal MatchLongestEntityPolicyType(PolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MetadataKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MetadataKind.cs new file mode 100644 index 000000000000..184ee345ed77 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MetadataKind.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The entity Metadata object kind. + internal readonly partial struct MetadataKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MetadataKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DateMetadataValue = "DateMetadata"; + private const string DateTimeMetadataValue = "DateTimeMetadata"; + private const string TimeMetadataValue = "TimeMetadata"; + private const string TemporalSetMetadataValue = "TemporalSetMetadata"; + private const string NumberMetadataValue = "NumberMetadata"; + private const string OrdinalMetadataValue = "OrdinalMetadata"; + private const string SpeedMetadataValue = "SpeedMetadata"; + private const string WeightMetadataValue = "WeightMetadata"; + private const string LengthMetadataValue = "LengthMetadata"; + private const string VolumeMetadataValue = "VolumeMetadata"; + private const string AreaMetadataValue = "AreaMetadata"; + private const string AgeMetadataValue = "AgeMetadata"; + private const string InformationMetadataValue = "InformationMetadata"; + private const string TemperatureMetadataValue = "TemperatureMetadata"; + private const string CurrencyMetadataValue = "CurrencyMetadata"; + private const string NumericRangeMetadataValue = "NumericRangeMetadata"; + private const string TemporalSpanMetadataValue = "TemporalSpanMetadata"; + + /// Metadata for date-related values. + public static MetadataKind DateMetadata { get; } = new MetadataKind(DateMetadataValue); + /// Metadata for date and time-related values. + public static MetadataKind DateTimeMetadata { get; } = new MetadataKind(DateTimeMetadataValue); + /// Metadata for time-related values. + public static MetadataKind TimeMetadata { get; } = new MetadataKind(TimeMetadataValue); + /// Metadata for set of time-related values. + public static MetadataKind TemporalSetMetadata { get; } = new MetadataKind(TemporalSetMetadataValue); + /// Metadata for numeric values. + public static MetadataKind NumberMetadata { get; } = new MetadataKind(NumberMetadataValue); + /// Metadata for ordinal numbers. + public static MetadataKind OrdinalMetadata { get; } = new MetadataKind(OrdinalMetadataValue); + /// Metadata for speed-related values. + public static MetadataKind SpeedMetadata { get; } = new MetadataKind(SpeedMetadataValue); + /// Metadata for weight-related values. + public static MetadataKind WeightMetadata { get; } = new MetadataKind(WeightMetadataValue); + /// Metadata for length-related values. + public static MetadataKind LengthMetadata { get; } = new MetadataKind(LengthMetadataValue); + /// Metadata for volume-related values. + public static MetadataKind VolumeMetadata { get; } = new MetadataKind(VolumeMetadataValue); + /// Metadata for area-related values. + public static MetadataKind AreaMetadata { get; } = new MetadataKind(AreaMetadataValue); + /// Metadata for age-related values. + public static MetadataKind AgeMetadata { get; } = new MetadataKind(AgeMetadataValue); + /// Metadata for information-related values. + public static MetadataKind InformationMetadata { get; } = new MetadataKind(InformationMetadataValue); + /// Metadata for temperature-related values. + public static MetadataKind TemperatureMetadata { get; } = new MetadataKind(TemperatureMetadataValue); + /// Metadata for currency-related values. + public static MetadataKind CurrencyMetadata { get; } = new MetadataKind(CurrencyMetadataValue); + /// Metadata for numeric range values. + public static MetadataKind NumericRangeMetadata { get; } = new MetadataKind(NumericRangeMetadataValue); + /// Metadata for temporal span values. + public static MetadataKind TemporalSpanMetadata { get; } = new MetadataKind(TemporalSpanMetadataValue); + /// Determines if two values are the same. + public static bool operator ==(MetadataKind left, MetadataKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MetadataKind left, MetadataKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MetadataKind(string value) => new MetadataKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetadataKind other && Equals(other); + /// + public bool Equals(MetadataKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageInput.Serialization.cs new file mode 100644 index 000000000000..15438677ec4a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageInput.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class MultiLanguageInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MultiLanguageInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultiLanguageInput(document.RootElement, options); + } + + internal static MultiLanguageInput DeserializeMultiLanguageInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string text = default; + string language = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MultiLanguageInput(id, text, language, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support writing '{options.Format}' format."); + } + } + + MultiLanguageInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMultiLanguageInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MultiLanguageInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMultiLanguageInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageInput.cs new file mode 100644 index 000000000000..1da2cfa629aa --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageInput.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains an input document to be analyzed by the service. + public partial class MultiLanguageInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// or is null. + public MultiLanguageInput(string id, string text) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(text, nameof(text)); + + Id = id; + Text = text; + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default. (Following only applies to 2023-04-15-preview and above) For Auto Language Detection, use \"auto\". If not set, use \"en\" for English as default. + /// Keeps track of any properties unknown to the library. + internal MultiLanguageInput(string id, string text, string language, IDictionary serializedAdditionalRawData) + { + Id = id; + Text = text; + Language = language; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultiLanguageInput() + { + } + + /// A unique, non-empty document identifier. + public string Id { get; } + /// The input text to process. + public string Text { get; } + /// (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default. (Following only applies to 2023-04-15-preview and above) For Auto Language Detection, use \"auto\". If not set, use \"en\" for English as default. + public string Language { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageTextInput.Serialization.cs new file mode 100644 index 000000000000..17bbe5de8747 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageTextInput.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class MultiLanguageTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(MultiLanguageInputs)) + { + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in MultiLanguageInputs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MultiLanguageTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultiLanguageTextInput(document.RootElement, options); + } + + internal static MultiLanguageTextInput DeserializeMultiLanguageTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MultiLanguageInput.DeserializeMultiLanguageInput(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MultiLanguageTextInput(documents ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support writing '{options.Format}' format."); + } + } + + MultiLanguageTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMultiLanguageTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MultiLanguageTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMultiLanguageTextInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageTextInput.cs new file mode 100644 index 000000000000..696bf72457db --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/MultiLanguageTextInput.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Collection of input documents to be analyzed by the service. + public partial class MultiLanguageTextInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public MultiLanguageTextInput() + { + MultiLanguageInputs = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The input documents to be analyzed. + /// Keeps track of any properties unknown to the library. + internal MultiLanguageTextInput(IList multiLanguageInputs, IDictionary serializedAdditionalRawData) + { + MultiLanguageInputs = multiLanguageInputs; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The input documents to be analyzed. + public IList MultiLanguageInputs { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntity.Serialization.cs new file mode 100644 index 000000000000..37acfa6ca63e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntity.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class NamedEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + if (Optional.IsDefined(Subcategory)) + { + writer.WritePropertyName("subcategory"u8); + writer.WriteStringValue(Subcategory); + } + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NamedEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamedEntity(document.RootElement, options); + } + + internal static NamedEntity DeserializeNamedEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + string category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamedEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NamedEntity)} does not support writing '{options.Format}' format."); + } + } + + NamedEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNamedEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamedEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NamedEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNamedEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntity.cs new file mode 100644 index 000000000000..e9fbfd1759a5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntity.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Defines the detected entity object containing the entity category and entity text detected, etc. + public partial class NamedEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// or is null. + internal NamedEntity(string text, string category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(category, nameof(category)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Keeps track of any properties unknown to the library. + internal NamedEntity(string text, string category, string subcategory, int offset, int length, double confidenceScore, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NamedEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Entity type. + public string Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntityWithMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntityWithMetadata.Serialization.cs new file mode 100644 index 000000000000..c1ae7d426497 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntityWithMetadata.Serialization.cs @@ -0,0 +1,236 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class NamedEntityWithMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + if (Optional.IsDefined(Subcategory)) + { + writer.WritePropertyName("subcategory"u8); + writer.WriteStringValue(Subcategory); + } + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("tags"u8); + writer.WriteStartArray(); + foreach (var item in Tags) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteObjectValue(Metadata, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NamedEntityWithMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamedEntityWithMetadata(document.RootElement, options); + } + + internal static NamedEntityWithMetadata DeserializeNamedEntityWithMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + string category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + string type = default; + IReadOnlyList tags = default; + BaseMetadata metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityTag.DeserializeEntityTag(item, options)); + } + tags = array; + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = BaseMetadata.DeserializeBaseMetadata(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamedEntityWithMetadata( + text, + category, + subcategory, + offset, + length, + confidenceScore, + type, + tags, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support writing '{options.Format}' format."); + } + } + + NamedEntityWithMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNamedEntityWithMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NamedEntityWithMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNamedEntityWithMetadata(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntityWithMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntityWithMetadata.cs new file mode 100644 index 000000000000..61cfe57317d5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NamedEntityWithMetadata.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Entity object with tags and metadata. + public partial class NamedEntityWithMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + /// List of entity tags. Tags are to express some similarities/affinity between entities. + /// , , or is null. + internal NamedEntityWithMetadata(string text, string category, int offset, int length, double confidenceScore, string type, IEnumerable tags) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(category, nameof(category)); + Argument.AssertNotNull(type, nameof(type)); + Argument.AssertNotNull(tags, nameof(tags)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Type = type; + Tags = tags.ToList(); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + /// List of entity tags. Tags are to express some similarities/affinity between entities. + /// + /// The entity metadata object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal NamedEntityWithMetadata(string text, string category, string subcategory, int offset, int length, double confidenceScore, string type, IReadOnlyList tags, BaseMetadata metadata, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Type = type; + Tags = tags; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NamedEntityWithMetadata() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Entity type. + public string Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + public string Type { get; } + /// List of entity tags. Tags are to express some similarities/affinity between entities. + public IReadOnlyList Tags { get; } + /// + /// The entity metadata object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + public BaseMetadata Metadata { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberKind.cs new file mode 100644 index 000000000000..5e6295a5f1fd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberKind.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The type of the extracted number entity. + public readonly partial struct NumberKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NumberKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IntegerValue = "Integer"; + private const string DecimalValue = "Decimal"; + private const string PowerValue = "Power"; + private const string FractionValue = "Fraction"; + private const string PercentValue = "Percent"; + private const string UnspecifiedValue = "Unspecified"; + + /// Integer number. + public static NumberKind Integer { get; } = new NumberKind(IntegerValue); + /// Decimal number. + public static NumberKind Decimal { get; } = new NumberKind(DecimalValue); + /// Power number. + public static NumberKind Power { get; } = new NumberKind(PowerValue); + /// Fraction number. + public static NumberKind Fraction { get; } = new NumberKind(FractionValue); + /// Percent number. + public static NumberKind Percent { get; } = new NumberKind(PercentValue); + /// Unspecified number kind. + public static NumberKind Unspecified { get; } = new NumberKind(UnspecifiedValue); + /// Determines if two values are the same. + public static bool operator ==(NumberKind left, NumberKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NumberKind left, NumberKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NumberKind(string value) => new NumberKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NumberKind other && Equals(other); + /// + public bool Equals(NumberKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberMetadata.Serialization.cs new file mode 100644 index 000000000000..b792925ae390 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class NumberMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumberMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("numberKind"u8); + writer.WriteStringValue(NumberKind.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + } + + NumberMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumberMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNumberMetadata(document.RootElement, options); + } + + internal static NumberMetadata DeserializeNumberMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NumberKind numberKind = default; + double value = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("numberKind"u8)) + { + numberKind = new NumberKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NumberMetadata(metadataKind, serializedAdditionalRawData, numberKind, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NumberMetadata)} does not support writing '{options.Format}' format."); + } + } + + NumberMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNumberMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NumberMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new NumberMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumberMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberMetadata.cs new file mode 100644 index 000000000000..0bde97482626 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumberMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A metadata for numeric entity instances. + public partial class NumberMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// Kind of the number type. + /// A numeric representation of what the extracted text denotes. + internal NumberMetadata(NumberKind numberKind, double value) + { + MetadataKind = MetadataKind.NumberMetadata; + NumberKind = numberKind; + Value = value; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// Kind of the number type. + /// A numeric representation of what the extracted text denotes. + internal NumberMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, NumberKind numberKind, double value) : base(metadataKind, serializedAdditionalRawData) + { + NumberKind = numberKind; + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal NumberMetadata() + { + } + + /// Kind of the number type. + public NumberKind NumberKind { get; } + /// A numeric representation of what the extracted text denotes. + public double Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumericRangeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumericRangeMetadata.Serialization.cs new file mode 100644 index 000000000000..d5ca37f26ae6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumericRangeMetadata.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class NumericRangeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("rangeKind"u8); + writer.WriteStringValue(RangeKind.ToString()); + writer.WritePropertyName("minimum"u8); + writer.WriteNumberValue(Minimum); + writer.WritePropertyName("maximum"u8); + writer.WriteNumberValue(Maximum); + if (Optional.IsDefined(RangeInclusivity)) + { + writer.WritePropertyName("rangeInclusivity"u8); + writer.WriteStringValue(RangeInclusivity.Value.ToString()); + } + } + + NumericRangeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNumericRangeMetadata(document.RootElement, options); + } + + internal static NumericRangeMetadata DeserializeNumericRangeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RangeKind rangeKind = default; + double minimum = default; + double maximum = default; + RangeInclusivity? rangeInclusivity = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rangeKind"u8)) + { + rangeKind = new RangeKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("minimum"u8)) + { + minimum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("maximum"u8)) + { + maximum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("rangeInclusivity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rangeInclusivity = new RangeInclusivity(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NumericRangeMetadata( + metadataKind, + serializedAdditionalRawData, + rangeKind, + minimum, + maximum, + rangeInclusivity); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support writing '{options.Format}' format."); + } + } + + NumericRangeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNumericRangeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new NumericRangeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumericRangeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumericRangeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumericRangeMetadata.cs new file mode 100644 index 000000000000..768f3484446f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/NumericRangeMetadata.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// represents the Metadata of numeric intervals. + public partial class NumericRangeMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// Kind of numeric ranges supported - like Number, Speed, etc. + /// The beginning value of the interval. + /// The ending value of the interval. + internal NumericRangeMetadata(RangeKind rangeKind, double minimum, double maximum) + { + MetadataKind = MetadataKind.NumericRangeMetadata; + RangeKind = rangeKind; + Minimum = minimum; + Maximum = maximum; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// Kind of numeric ranges supported - like Number, Speed, etc. + /// The beginning value of the interval. + /// The ending value of the interval. + /// The inclusiveness of this range. + internal NumericRangeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, RangeKind rangeKind, double minimum, double maximum, RangeInclusivity? rangeInclusivity) : base(metadataKind, serializedAdditionalRawData) + { + RangeKind = rangeKind; + Minimum = minimum; + Maximum = maximum; + RangeInclusivity = rangeInclusivity; + } + + /// Initializes a new instance of for deserialization. + internal NumericRangeMetadata() + { + } + + /// Kind of numeric ranges supported - like Number, Speed, etc. + public RangeKind RangeKind { get; } + /// The beginning value of the interval. + public double Minimum { get; } + /// The ending value of the interval. + public double Maximum { get; } + /// The inclusiveness of this range. + public RangeInclusivity? RangeInclusivity { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/OrdinalMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/OrdinalMetadata.Serialization.cs new file mode 100644 index 000000000000..763a9fe3f2c5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/OrdinalMetadata.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class OrdinalMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("offset"u8); + writer.WriteStringValue(Offset); + writer.WritePropertyName("relativeTo"u8); + writer.WriteStringValue(RelativeTo.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + + OrdinalMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrdinalMetadata(document.RootElement, options); + } + + internal static OrdinalMetadata DeserializeOrdinalMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string offset = default; + RelativeTo relativeTo = default; + string value = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetString(); + continue; + } + if (property.NameEquals("relativeTo"u8)) + { + relativeTo = new RelativeTo(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OrdinalMetadata(metadataKind, serializedAdditionalRawData, offset, relativeTo, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support writing '{options.Format}' format."); + } + } + + OrdinalMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOrdinalMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OrdinalMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOrdinalMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/OrdinalMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/OrdinalMetadata.cs new file mode 100644 index 000000000000..a0d4f385f1bd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/OrdinalMetadata.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A metadata for numeric entity instances. + public partial class OrdinalMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + /// or is null. + internal OrdinalMetadata(string offset, RelativeTo relativeTo, string value) + { + Argument.AssertNotNull(offset, nameof(offset)); + Argument.AssertNotNull(value, nameof(value)); + + MetadataKind = MetadataKind.OrdinalMetadata; + Offset = offset; + RelativeTo = relativeTo; + Value = value; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + internal OrdinalMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, string offset, RelativeTo relativeTo, string value) : base(metadataKind, serializedAdditionalRawData) + { + Offset = offset; + RelativeTo = relativeTo; + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal OrdinalMetadata() + { + } + + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + public string Offset { get; } + /// The reference point that the ordinal number denotes. + public RelativeTo RelativeTo { get; } + /// A simple arithmetic expression that the ordinal denotes. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionContent.Serialization.cs new file mode 100644 index 000000000000..29c01556180a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionContent.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class PiiActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain.Value.ToString()); + } + if (Optional.IsCollectionDefined(PiiCategories)) + { + writer.WritePropertyName("piiCategories"u8); + writer.WriteStartArray(); + foreach (var item in PiiCategories) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsCollectionDefined(ExcludePiiCategories)) + { + writer.WritePropertyName("excludePiiCategories"u8); + writer.WriteStartArray(); + foreach (var item in ExcludePiiCategories) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RedactionCharacter)) + { + writer.WritePropertyName("redactionCharacter"u8); + writer.WriteStringValue(RedactionCharacter.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PiiActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiActionContent(document.RootElement, options); + } + + internal static PiiActionContent DeserializePiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + PiiDomain? domain = default; + IList piiCategories = default; + StringIndexType? stringIndexType = default; + IList excludePiiCategories = default; + RedactionCharacter? redactionCharacter = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domain = new PiiDomain(property.Value.GetString()); + continue; + } + if (property.NameEquals("piiCategories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new PiiCategory(item.GetString())); + } + piiCategories = array; + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("excludePiiCategories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new PiiCategoriesExclude(item.GetString())); + } + excludePiiCategories = array; + continue; + } + if (property.NameEquals("redactionCharacter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionCharacter = new RedactionCharacter(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiActionContent( + loggingOptOut, + modelVersion, + domain, + piiCategories ?? new ChangeTrackingList(), + stringIndexType, + excludePiiCategories ?? new ChangeTrackingList(), + redactionCharacter, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{options.Format}' format."); + } + } + + PiiActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PiiActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionContent.cs new file mode 100644 index 000000000000..5fdce1559484 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionContent.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a PII Entities Recognition task. + public partial class PiiActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PiiActionContent() + { + PiiCategories = new ChangeTrackingList(); + ExcludePiiCategories = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Domain for PII task. + /// Enumeration of PII categories to be returned in the response. + /// StringIndexType to be used for analysis. + /// Enumeration of PII categories to be excluded in the response. + /// Character to be used for redaction. Default in '*'. + /// Keeps track of any properties unknown to the library. + internal PiiActionContent(bool? loggingOptOut, string modelVersion, PiiDomain? domain, IList piiCategories, StringIndexType? stringIndexType, IList excludePiiCategories, RedactionCharacter? redactionCharacter, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + Domain = domain; + PiiCategories = piiCategories; + StringIndexType = stringIndexType; + ExcludePiiCategories = excludePiiCategories; + RedactionCharacter = redactionCharacter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Domain for PII task. + public PiiDomain? Domain { get; set; } + /// Enumeration of PII categories to be returned in the response. + public IList PiiCategories { get; } + /// StringIndexType to be used for analysis. + public StringIndexType? StringIndexType { get; set; } + /// Enumeration of PII categories to be excluded in the response. + public IList ExcludePiiCategories { get; } + /// Character to be used for redaction. Default in '*'. + public RedactionCharacter? RedactionCharacter { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionResult.Serialization.cs new file mode 100644 index 000000000000..4e53776765b5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionResult.Serialization.cs @@ -0,0 +1,223 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class PiiActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("redactedText"u8); + writer.WriteStringValue(RedactedText); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PiiActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiActionResult(document.RootElement, options); + } + + internal static PiiActionResult DeserializePiiActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + string redactedText = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("redactedText"u8)) + { + redactedText = property.Value.GetString(); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntity.DeserializeNamedEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiActionResult( + id, + warnings, + statistics, + redactedText, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiActionResult)} does not support writing '{options.Format}' format."); + } + } + + PiiActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PiiActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionResult.cs new file mode 100644 index 000000000000..6c86b7ef74a9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiActionResult.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the PII results with detected language. + public partial class PiiActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Returns redacted text. + /// Recognized entities in the document. + /// , , or is null. + internal PiiActionResult(string id, IEnumerable warnings, string redactedText, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(redactedText, nameof(redactedText)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + RedactedText = redactedText; + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Returns redacted text. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal PiiActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, string redactedText, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + RedactedText = redactedText; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PiiActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Returns redacted text. + public string RedactedText { get; } + /// Recognized entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiCategoriesExclude.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiCategoriesExclude.cs new file mode 100644 index 000000000000..935dc337e81a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiCategoriesExclude.cs @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// (Optional) describes the PII categories to return. + public readonly partial struct PiiCategoriesExclude : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PiiCategoriesExclude(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AbaRoutingNumberValue = "ABARoutingNumber"; + private const string ArNationalIdentityNumberValue = "ARNationalIdentityNumber"; + private const string AuBankAccountNumberValue = "AUBankAccountNumber"; + private const string AuDriversLicenseNumberValue = "AUDriversLicenseNumber"; + private const string AuMedicalAccountNumberValue = "AUMedicalAccountNumber"; + private const string AuPassportNumberValue = "AUPassportNumber"; + private const string AuTaxFileNumberValue = "AUTaxFileNumber"; + private const string AuBusinessNumberValue = "AUBusinessNumber"; + private const string AuCompanyNumberValue = "AUCompanyNumber"; + private const string AtIdentityCardValue = "ATIdentityCard"; + private const string AtTaxIdentificationNumberValue = "ATTaxIdentificationNumber"; + private const string AtValueAddedTaxNumberValue = "ATValueAddedTaxNumber"; + private const string AzureDocumentDbauthKeyValue = "AzureDocumentDBAuthKey"; + private const string AzureIaasDatabaseConnectionAndSqlStringValue = "AzureIAASDatabaseConnectionAndSQLString"; + private const string AzureIoTConnectionStringValue = "AzureIoTConnectionString"; + private const string AzurePublishSettingPasswordValue = "AzurePublishSettingPassword"; + private const string AzureRedisCacheStringValue = "AzureRedisCacheString"; + private const string AzureSasValue = "AzureSAS"; + private const string AzureServiceBusStringValue = "AzureServiceBusString"; + private const string AzureStorageAccountKeyValue = "AzureStorageAccountKey"; + private const string AzureStorageAccountGenericValue = "AzureStorageAccountGeneric"; + private const string BeNationalNumberValue = "BENationalNumber"; + private const string BeNationalNumberV2Value = "BENationalNumberV2"; + private const string BeValueAddedTaxNumberValue = "BEValueAddedTaxNumber"; + private const string BrCpfNumberValue = "BRCPFNumber"; + private const string BrLegalEntityNumberValue = "BRLegalEntityNumber"; + private const string BrNationalIdRgValue = "BRNationalIDRG"; + private const string BgUniformCivilNumberValue = "BGUniformCivilNumber"; + private const string CaBankAccountNumberValue = "CABankAccountNumber"; + private const string CaDriversLicenseNumberValue = "CADriversLicenseNumber"; + private const string CaHealthServiceNumberValue = "CAHealthServiceNumber"; + private const string CaPassportNumberValue = "CAPassportNumber"; + private const string CaPersonalHealthIdentificationValue = "CAPersonalHealthIdentification"; + private const string CaSocialInsuranceNumberValue = "CASocialInsuranceNumber"; + private const string ClIdentityCardNumberValue = "CLIdentityCardNumber"; + private const string CnResidentIdentityCardNumberValue = "CNResidentIdentityCardNumber"; + private const string CreditCardNumberValue = "CreditCardNumber"; + private const string HrIdentityCardNumberValue = "HRIdentityCardNumber"; + private const string HrNationalIdNumberValue = "HRNationalIDNumber"; + private const string HrPersonalIdentificationNumberValue = "HRPersonalIdentificationNumber"; + private const string HrPersonalIdentificationOIBNumberV2Value = "HRPersonalIdentificationOIBNumberV2"; + private const string CyIdentityCardValue = "CYIdentityCard"; + private const string CyTaxIdentificationNumberValue = "CYTaxIdentificationNumber"; + private const string CzPersonalIdentityNumberValue = "CZPersonalIdentityNumber"; + private const string CzPersonalIdentityV2Value = "CZPersonalIdentityV2"; + private const string DkPersonalIdentificationNumberValue = "DKPersonalIdentificationNumber"; + private const string DkPersonalIdentificationV2Value = "DKPersonalIdentificationV2"; + private const string DrugEnforcementAgencyNumberValue = "DrugEnforcementAgencyNumber"; + private const string EePersonalIdentificationCodeValue = "EEPersonalIdentificationCode"; + private const string EuDebitCardNumberValue = "EUDebitCardNumber"; + private const string EuDriversLicenseNumberValue = "EUDriversLicenseNumber"; + private const string EuGpsCoordinatesValue = "EUGPSCoordinates"; + private const string EuNationalIdentificationNumberValue = "EUNationalIdentificationNumber"; + private const string EuPassportNumberValue = "EUPassportNumber"; + private const string EuSocialSecurityNumberValue = "EUSocialSecurityNumber"; + private const string EuTaxIdentificationNumberValue = "EUTaxIdentificationNumber"; + private const string FiEuropeanHealthNumberValue = "FIEuropeanHealthNumber"; + private const string FiNationalIdValue = "FINationalID"; + private const string FiNationalIdV2Value = "FINationalIDV2"; + private const string FiPassportNumberValue = "FIPassportNumber"; + private const string FrDriversLicenseNumberValue = "FRDriversLicenseNumber"; + private const string FrHealthInsuranceNumberValue = "FRHealthInsuranceNumber"; + private const string FrNationalIdValue = "FRNationalID"; + private const string FrPassportNumberValue = "FRPassportNumber"; + private const string FrSocialSecurityNumberValue = "FRSocialSecurityNumber"; + private const string FrTaxIdentificationNumberValue = "FRTaxIdentificationNumber"; + private const string FrValueAddedTaxNumberValue = "FRValueAddedTaxNumber"; + private const string DeDriversLicenseNumberValue = "DEDriversLicenseNumber"; + private const string DePassportNumberValue = "DEPassportNumber"; + private const string DeIdentityCardNumberValue = "DEIdentityCardNumber"; + private const string DeTaxIdentificationNumberValue = "DETaxIdentificationNumber"; + private const string DeValueAddedNumberValue = "DEValueAddedNumber"; + private const string GrNationalIdCardValue = "GRNationalIDCard"; + private const string GrNationalIdV2Value = "GRNationalIDV2"; + private const string GrTaxIdentificationNumberValue = "GRTaxIdentificationNumber"; + private const string HkIdentityCardNumberValue = "HKIdentityCardNumber"; + private const string HuValueAddedNumberValue = "HUValueAddedNumber"; + private const string HuPersonalIdentificationNumberValue = "HUPersonalIdentificationNumber"; + private const string HuTaxIdentificationNumberValue = "HUTaxIdentificationNumber"; + private const string InPermanentAccountValue = "INPermanentAccount"; + private const string InUniqueIdentificationNumberValue = "INUniqueIdentificationNumber"; + private const string IdIdentityCardNumberValue = "IDIdentityCardNumber"; + private const string InternationalBankingAccountNumberValue = "InternationalBankingAccountNumber"; + private const string IePersonalPublicServiceNumberValue = "IEPersonalPublicServiceNumber"; + private const string IePersonalPublicServiceNumberV2Value = "IEPersonalPublicServiceNumberV2"; + private const string IlBankAccountNumberValue = "ILBankAccountNumber"; + private const string IlNationalIdValue = "ILNationalID"; + private const string ItDriversLicenseNumberValue = "ITDriversLicenseNumber"; + private const string ItFiscalCodeValue = "ITFiscalCode"; + private const string ItValueAddedTaxNumberValue = "ITValueAddedTaxNumber"; + private const string JpBankAccountNumberValue = "JPBankAccountNumber"; + private const string JpDriversLicenseNumberValue = "JPDriversLicenseNumber"; + private const string JpPassportNumberValue = "JPPassportNumber"; + private const string JpResidentRegistrationNumberValue = "JPResidentRegistrationNumber"; + private const string JpSocialInsuranceNumberValue = "JPSocialInsuranceNumber"; + private const string JpMyNumberCorporateValue = "JPMyNumberCorporate"; + private const string JpMyNumberPersonalValue = "JPMyNumberPersonal"; + private const string JpResidenceCardNumberValue = "JPResidenceCardNumber"; + private const string LvPersonalCodeValue = "LVPersonalCode"; + private const string LtPersonalCodeValue = "LTPersonalCode"; + private const string LuNationalIdentificationNumberNaturalValue = "LUNationalIdentificationNumberNatural"; + private const string LuNationalIdentificationNumberNonNaturalValue = "LUNationalIdentificationNumberNonNatural"; + private const string MyIdentityCardNumberValue = "MYIdentityCardNumber"; + private const string MtIdentityCardNumberValue = "MTIdentityCardNumber"; + private const string MtTaxIdNumberValue = "MTTaxIDNumber"; + private const string NlCitizensServiceNumberValue = "NLCitizensServiceNumber"; + private const string NlCitizensServiceNumberV2Value = "NLCitizensServiceNumberV2"; + private const string NlTaxIdentificationNumberValue = "NLTaxIdentificationNumber"; + private const string NlValueAddedTaxNumberValue = "NLValueAddedTaxNumber"; + private const string NzBankAccountNumberValue = "NZBankAccountNumber"; + private const string NzDriversLicenseNumberValue = "NZDriversLicenseNumber"; + private const string NzInlandRevenueNumberValue = "NZInlandRevenueNumber"; + private const string NzMinistryOfHealthNumberValue = "NZMinistryOfHealthNumber"; + private const string NzSocialWelfareNumberValue = "NZSocialWelfareNumber"; + private const string NoIdentityNumberValue = "NOIdentityNumber"; + private const string PhUnifiedMultiPurposeIdNumberValue = "PHUnifiedMultiPurposeIDNumber"; + private const string PlIdentityCardValue = "PLIdentityCard"; + private const string PlNationalIdValue = "PLNationalID"; + private const string PlNationalIdV2Value = "PLNationalIDV2"; + private const string PlPassportNumberValue = "PLPassportNumber"; + private const string PlTaxIdentificationNumberValue = "PLTaxIdentificationNumber"; + private const string PlRegonNumberValue = "PLREGONNumber"; + private const string PtCitizenCardNumberValue = "PTCitizenCardNumber"; + private const string PtCitizenCardNumberV2Value = "PTCitizenCardNumberV2"; + private const string PtTaxIdentificationNumberValue = "PTTaxIdentificationNumber"; + private const string RoPersonalNumericalCodeValue = "ROPersonalNumericalCode"; + private const string RuPassportNumberDomesticValue = "RUPassportNumberDomestic"; + private const string RuPassportNumberInternationalValue = "RUPassportNumberInternational"; + private const string SaNationalIdValue = "SANationalID"; + private const string SgNationalRegistrationIdentityCardNumberValue = "SGNationalRegistrationIdentityCardNumber"; + private const string SkPersonalNumberValue = "SKPersonalNumber"; + private const string SiTaxIdentificationNumberValue = "SITaxIdentificationNumber"; + private const string SiUniqueMasterCitizenNumberValue = "SIUniqueMasterCitizenNumber"; + private const string ZaIdentificationNumberValue = "ZAIdentificationNumber"; + private const string KrResidentRegistrationNumberValue = "KRResidentRegistrationNumber"; + private const string EsDniValue = "ESDNI"; + private const string EsSocialSecurityNumberValue = "ESSocialSecurityNumber"; + private const string EsTaxIdentificationNumberValue = "ESTaxIdentificationNumber"; + private const string SqlServerConnectionStringValue = "SQLServerConnectionString"; + private const string SeNationalIdValue = "SENationalID"; + private const string SeNationalIdV2Value = "SENationalIDV2"; + private const string SePassportNumberValue = "SEPassportNumber"; + private const string SeTaxIdentificationNumberValue = "SETaxIdentificationNumber"; + private const string SwiftCodeValue = "SWIFTCode"; + private const string ChSocialSecurityNumberValue = "CHSocialSecurityNumber"; + private const string TwNationalIdValue = "TWNationalID"; + private const string TwPassportNumberValue = "TWPassportNumber"; + private const string TwResidentCertificateValue = "TWResidentCertificate"; + private const string ThPopulationIdentificationCodeValue = "THPopulationIdentificationCode"; + private const string TrNationalIdentificationNumberValue = "TRNationalIdentificationNumber"; + private const string UkDriversLicenseNumberValue = "UKDriversLicenseNumber"; + private const string UkElectoralRollNumberValue = "UKElectoralRollNumber"; + private const string UkNationalHealthNumberValue = "UKNationalHealthNumber"; + private const string UkNationalInsuranceNumberValue = "UKNationalInsuranceNumber"; + private const string UkUniqueTaxpayerNumberValue = "UKUniqueTaxpayerNumber"; + private const string UsUkPassportNumberValue = "USUKPassportNumber"; + private const string UsBankAccountNumberValue = "USBankAccountNumber"; + private const string UsDriversLicenseNumberValue = "USDriversLicenseNumber"; + private const string UsIndividualTaxpayerIdentificationValue = "USIndividualTaxpayerIdentification"; + private const string UsSocialSecurityNumberValue = "USSocialSecurityNumber"; + private const string UaPassportNumberDomesticValue = "UAPassportNumberDomestic"; + private const string UaPassportNumberInternationalValue = "UAPassportNumberInternational"; + private const string OrganizationValue = "Organization"; + private const string EmailValue = "Email"; + private const string URLValue = "URL"; + private const string AgeValue = "Age"; + private const string PhoneNumberValue = "PhoneNumber"; + private const string IPAddressValue = "IPAddress"; + private const string DateValue = "Date"; + private const string PersonValue = "Person"; + private const string AddressValue = "Address"; + + /// ABA Routing number. + public static PiiCategoriesExclude AbaRoutingNumber { get; } = new PiiCategoriesExclude(AbaRoutingNumberValue); + /// AR National Identity Number. + public static PiiCategoriesExclude ArNationalIdentityNumber { get; } = new PiiCategoriesExclude(ArNationalIdentityNumberValue); + /// AT Identity Card. + public static PiiCategoriesExclude AuBankAccountNumber { get; } = new PiiCategoriesExclude(AuBankAccountNumberValue); + /// AU Driver's License Number. + public static PiiCategoriesExclude AuDriversLicenseNumber { get; } = new PiiCategoriesExclude(AuDriversLicenseNumberValue); + /// AU Medical Account Number. + public static PiiCategoriesExclude AuMedicalAccountNumber { get; } = new PiiCategoriesExclude(AuMedicalAccountNumberValue); + /// AU Passport Number. + public static PiiCategoriesExclude AuPassportNumber { get; } = new PiiCategoriesExclude(AuPassportNumberValue); + /// AU Tax File Number. + public static PiiCategoriesExclude AuTaxFileNumber { get; } = new PiiCategoriesExclude(AuTaxFileNumberValue); + /// AU Business Number. + public static PiiCategoriesExclude AuBusinessNumber { get; } = new PiiCategoriesExclude(AuBusinessNumberValue); + /// AU Company Number. + public static PiiCategoriesExclude AuCompanyNumber { get; } = new PiiCategoriesExclude(AuCompanyNumberValue); + /// AT Identity Card. + public static PiiCategoriesExclude AtIdentityCard { get; } = new PiiCategoriesExclude(AtIdentityCardValue); + /// AT Tax Identification Number. + public static PiiCategoriesExclude AtTaxIdentificationNumber { get; } = new PiiCategoriesExclude(AtTaxIdentificationNumberValue); + /// AT Value Added Tax Number. + public static PiiCategoriesExclude AtValueAddedTaxNumber { get; } = new PiiCategoriesExclude(AtValueAddedTaxNumberValue); + /// Azure Document DB Auth Key. + public static PiiCategoriesExclude AzureDocumentDbauthKey { get; } = new PiiCategoriesExclude(AzureDocumentDbauthKeyValue); + /// Azure IAAS Database Connection And SQL String. + public static PiiCategoriesExclude AzureIaasDatabaseConnectionAndSqlString { get; } = new PiiCategoriesExclude(AzureIaasDatabaseConnectionAndSqlStringValue); + /// Azure IoT Connection String. + public static PiiCategoriesExclude AzureIoTConnectionString { get; } = new PiiCategoriesExclude(AzureIoTConnectionStringValue); + /// Azure Publish Setting Password. + public static PiiCategoriesExclude AzurePublishSettingPassword { get; } = new PiiCategoriesExclude(AzurePublishSettingPasswordValue); + /// Azure Redis Cache String. + public static PiiCategoriesExclude AzureRedisCacheString { get; } = new PiiCategoriesExclude(AzureRedisCacheStringValue); + /// Azure SAS. + public static PiiCategoriesExclude AzureSas { get; } = new PiiCategoriesExclude(AzureSasValue); + /// Azure Service Bus String. + public static PiiCategoriesExclude AzureServiceBusString { get; } = new PiiCategoriesExclude(AzureServiceBusStringValue); + /// Azure Storage Account Key. + public static PiiCategoriesExclude AzureStorageAccountKey { get; } = new PiiCategoriesExclude(AzureStorageAccountKeyValue); + /// Azure Storage Account Generic. + public static PiiCategoriesExclude AzureStorageAccountGeneric { get; } = new PiiCategoriesExclude(AzureStorageAccountGenericValue); + /// BE National Number. + public static PiiCategoriesExclude BeNationalNumber { get; } = new PiiCategoriesExclude(BeNationalNumberValue); + /// BE National Number V2. + public static PiiCategoriesExclude BeNationalNumberV2 { get; } = new PiiCategoriesExclude(BeNationalNumberV2Value); + /// BE Value Added Tax Number. + public static PiiCategoriesExclude BeValueAddedTaxNumber { get; } = new PiiCategoriesExclude(BeValueAddedTaxNumberValue); + /// BR CPF Number. + public static PiiCategoriesExclude BrCpfNumber { get; } = new PiiCategoriesExclude(BrCpfNumberValue); + /// BR Legal Entity Number. + public static PiiCategoriesExclude BrLegalEntityNumber { get; } = new PiiCategoriesExclude(BrLegalEntityNumberValue); + /// BR National ID RG. + public static PiiCategoriesExclude BrNationalIdRg { get; } = new PiiCategoriesExclude(BrNationalIdRgValue); + /// BG Uniform Civil Number. + public static PiiCategoriesExclude BgUniformCivilNumber { get; } = new PiiCategoriesExclude(BgUniformCivilNumberValue); + /// CA Bank Account Number. + public static PiiCategoriesExclude CaBankAccountNumber { get; } = new PiiCategoriesExclude(CaBankAccountNumberValue); + /// CA Driver's License Number. + public static PiiCategoriesExclude CaDriversLicenseNumber { get; } = new PiiCategoriesExclude(CaDriversLicenseNumberValue); + /// CA Health Service Number. + public static PiiCategoriesExclude CaHealthServiceNumber { get; } = new PiiCategoriesExclude(CaHealthServiceNumberValue); + /// CA Passport Number. + public static PiiCategoriesExclude CaPassportNumber { get; } = new PiiCategoriesExclude(CaPassportNumberValue); + /// CA Personal Health Identification. + public static PiiCategoriesExclude CaPersonalHealthIdentification { get; } = new PiiCategoriesExclude(CaPersonalHealthIdentificationValue); + /// CA Social Insurance Number. + public static PiiCategoriesExclude CaSocialInsuranceNumber { get; } = new PiiCategoriesExclude(CaSocialInsuranceNumberValue); + /// CL Identity Card Number. + public static PiiCategoriesExclude ClIdentityCardNumber { get; } = new PiiCategoriesExclude(ClIdentityCardNumberValue); + /// CN Resident Identity Card Number. + public static PiiCategoriesExclude CnResidentIdentityCardNumber { get; } = new PiiCategoriesExclude(CnResidentIdentityCardNumberValue); + /// Credit Card Number. + public static PiiCategoriesExclude CreditCardNumber { get; } = new PiiCategoriesExclude(CreditCardNumberValue); + /// HR Identity Card Number. + public static PiiCategoriesExclude HrIdentityCardNumber { get; } = new PiiCategoriesExclude(HrIdentityCardNumberValue); + /// HR National ID Number. + public static PiiCategoriesExclude HrNationalIdNumber { get; } = new PiiCategoriesExclude(HrNationalIdNumberValue); + /// HR Personal Identification Number. + public static PiiCategoriesExclude HrPersonalIdentificationNumber { get; } = new PiiCategoriesExclude(HrPersonalIdentificationNumberValue); + /// HR Personal Identification OIB Number V2. + public static PiiCategoriesExclude HrPersonalIdentificationOIBNumberV2 { get; } = new PiiCategoriesExclude(HrPersonalIdentificationOIBNumberV2Value); + /// CY Identity Card. + public static PiiCategoriesExclude CyIdentityCard { get; } = new PiiCategoriesExclude(CyIdentityCardValue); + /// CY Tax Identification Number. + public static PiiCategoriesExclude CyTaxIdentificationNumber { get; } = new PiiCategoriesExclude(CyTaxIdentificationNumberValue); + /// CZ Personal Identity Number. + public static PiiCategoriesExclude CzPersonalIdentityNumber { get; } = new PiiCategoriesExclude(CzPersonalIdentityNumberValue); + /// CZ Personal Identity V2. + public static PiiCategoriesExclude CzPersonalIdentityV2 { get; } = new PiiCategoriesExclude(CzPersonalIdentityV2Value); + /// DK Personal Identification Number. + public static PiiCategoriesExclude DkPersonalIdentificationNumber { get; } = new PiiCategoriesExclude(DkPersonalIdentificationNumberValue); + /// DK Personal Identification V2. + public static PiiCategoriesExclude DkPersonalIdentificationV2 { get; } = new PiiCategoriesExclude(DkPersonalIdentificationV2Value); + /// Drug Enforcement Agency Number. + public static PiiCategoriesExclude DrugEnforcementAgencyNumber { get; } = new PiiCategoriesExclude(DrugEnforcementAgencyNumberValue); + /// EE Personal Identification Code. + public static PiiCategoriesExclude EePersonalIdentificationCode { get; } = new PiiCategoriesExclude(EePersonalIdentificationCodeValue); + /// EU Debit Card Number. + public static PiiCategoriesExclude EuDebitCardNumber { get; } = new PiiCategoriesExclude(EuDebitCardNumberValue); + /// EU Driver's License Number. + public static PiiCategoriesExclude EuDriversLicenseNumber { get; } = new PiiCategoriesExclude(EuDriversLicenseNumberValue); + /// EU GPS Coordinates. + public static PiiCategoriesExclude EuGpsCoordinates { get; } = new PiiCategoriesExclude(EuGpsCoordinatesValue); + /// EU National Identification Number. + public static PiiCategoriesExclude EuNationalIdentificationNumber { get; } = new PiiCategoriesExclude(EuNationalIdentificationNumberValue); + /// EU Passport Number. + public static PiiCategoriesExclude EuPassportNumber { get; } = new PiiCategoriesExclude(EuPassportNumberValue); + /// EU Social Security Number. + public static PiiCategoriesExclude EuSocialSecurityNumber { get; } = new PiiCategoriesExclude(EuSocialSecurityNumberValue); + /// EU Tax Identification Number. + public static PiiCategoriesExclude EuTaxIdentificationNumber { get; } = new PiiCategoriesExclude(EuTaxIdentificationNumberValue); + /// FI European Health Number. + public static PiiCategoriesExclude FiEuropeanHealthNumber { get; } = new PiiCategoriesExclude(FiEuropeanHealthNumberValue); + /// FI National ID. + public static PiiCategoriesExclude FiNationalId { get; } = new PiiCategoriesExclude(FiNationalIdValue); + /// FI National ID V2. + public static PiiCategoriesExclude FiNationalIdV2 { get; } = new PiiCategoriesExclude(FiNationalIdV2Value); + /// FI Passport Number. + public static PiiCategoriesExclude FiPassportNumber { get; } = new PiiCategoriesExclude(FiPassportNumberValue); + /// FR Driver's License Number. + public static PiiCategoriesExclude FrDriversLicenseNumber { get; } = new PiiCategoriesExclude(FrDriversLicenseNumberValue); + /// FR Health Insurance Number. + public static PiiCategoriesExclude FrHealthInsuranceNumber { get; } = new PiiCategoriesExclude(FrHealthInsuranceNumberValue); + /// FR National ID. + public static PiiCategoriesExclude FrNationalId { get; } = new PiiCategoriesExclude(FrNationalIdValue); + /// FR Passport Number. + public static PiiCategoriesExclude FrPassportNumber { get; } = new PiiCategoriesExclude(FrPassportNumberValue); + /// FR Social Security Number. + public static PiiCategoriesExclude FrSocialSecurityNumber { get; } = new PiiCategoriesExclude(FrSocialSecurityNumberValue); + /// FR Tax Identification Number. + public static PiiCategoriesExclude FrTaxIdentificationNumber { get; } = new PiiCategoriesExclude(FrTaxIdentificationNumberValue); + /// FR Value Added Tax Number. + public static PiiCategoriesExclude FrValueAddedTaxNumber { get; } = new PiiCategoriesExclude(FrValueAddedTaxNumberValue); + /// DE Driver's License Number. + public static PiiCategoriesExclude DeDriversLicenseNumber { get; } = new PiiCategoriesExclude(DeDriversLicenseNumberValue); + /// DE Passport Number. + public static PiiCategoriesExclude DePassportNumber { get; } = new PiiCategoriesExclude(DePassportNumberValue); + /// DE Identity Card Number. + public static PiiCategoriesExclude DeIdentityCardNumber { get; } = new PiiCategoriesExclude(DeIdentityCardNumberValue); + /// DE Tax Identification Number. + public static PiiCategoriesExclude DeTaxIdentificationNumber { get; } = new PiiCategoriesExclude(DeTaxIdentificationNumberValue); + /// DE Value Added Number. + public static PiiCategoriesExclude DeValueAddedNumber { get; } = new PiiCategoriesExclude(DeValueAddedNumberValue); + /// GR National ID Card. + public static PiiCategoriesExclude GrNationalIdCard { get; } = new PiiCategoriesExclude(GrNationalIdCardValue); + /// GR National ID V2. + public static PiiCategoriesExclude GrNationalIdV2 { get; } = new PiiCategoriesExclude(GrNationalIdV2Value); + /// GR Tax Identification Number. + public static PiiCategoriesExclude GrTaxIdentificationNumber { get; } = new PiiCategoriesExclude(GrTaxIdentificationNumberValue); + /// HK Identity Card Number. + public static PiiCategoriesExclude HkIdentityCardNumber { get; } = new PiiCategoriesExclude(HkIdentityCardNumberValue); + /// HU Value Added Number. + public static PiiCategoriesExclude HuValueAddedNumber { get; } = new PiiCategoriesExclude(HuValueAddedNumberValue); + /// HU Personal Identification Number. + public static PiiCategoriesExclude HuPersonalIdentificationNumber { get; } = new PiiCategoriesExclude(HuPersonalIdentificationNumberValue); + /// HU Tax Identification Number. + public static PiiCategoriesExclude HuTaxIdentificationNumber { get; } = new PiiCategoriesExclude(HuTaxIdentificationNumberValue); + /// IN Permanent Account. + public static PiiCategoriesExclude InPermanentAccount { get; } = new PiiCategoriesExclude(InPermanentAccountValue); + /// IN Unique Identification Number. + public static PiiCategoriesExclude InUniqueIdentificationNumber { get; } = new PiiCategoriesExclude(InUniqueIdentificationNumberValue); + /// ID Identity Card Number. + public static PiiCategoriesExclude IdIdentityCardNumber { get; } = new PiiCategoriesExclude(IdIdentityCardNumberValue); + /// International Banking Account Number. + public static PiiCategoriesExclude InternationalBankingAccountNumber { get; } = new PiiCategoriesExclude(InternationalBankingAccountNumberValue); + /// IE Personal Public Service Number. + public static PiiCategoriesExclude IePersonalPublicServiceNumber { get; } = new PiiCategoriesExclude(IePersonalPublicServiceNumberValue); + /// IE Personal Public Service Number V2. + public static PiiCategoriesExclude IePersonalPublicServiceNumberV2 { get; } = new PiiCategoriesExclude(IePersonalPublicServiceNumberV2Value); + /// IL Bank Account Number. + public static PiiCategoriesExclude IlBankAccountNumber { get; } = new PiiCategoriesExclude(IlBankAccountNumberValue); + /// IL National ID. + public static PiiCategoriesExclude IlNationalId { get; } = new PiiCategoriesExclude(IlNationalIdValue); + /// IT Driver's License Number. + public static PiiCategoriesExclude ItDriversLicenseNumber { get; } = new PiiCategoriesExclude(ItDriversLicenseNumberValue); + /// IT Fiscal Code. + public static PiiCategoriesExclude ItFiscalCode { get; } = new PiiCategoriesExclude(ItFiscalCodeValue); + /// IT Value Added Tax Number. + public static PiiCategoriesExclude ItValueAddedTaxNumber { get; } = new PiiCategoriesExclude(ItValueAddedTaxNumberValue); + /// JP Bank Account Number. + public static PiiCategoriesExclude JpBankAccountNumber { get; } = new PiiCategoriesExclude(JpBankAccountNumberValue); + /// JP Driver's License Number. + public static PiiCategoriesExclude JpDriversLicenseNumber { get; } = new PiiCategoriesExclude(JpDriversLicenseNumberValue); + /// JP Passport Number. + public static PiiCategoriesExclude JpPassportNumber { get; } = new PiiCategoriesExclude(JpPassportNumberValue); + /// JP Resident Registration Number. + public static PiiCategoriesExclude JpResidentRegistrationNumber { get; } = new PiiCategoriesExclude(JpResidentRegistrationNumberValue); + /// JP Social Insurance Number. + public static PiiCategoriesExclude JpSocialInsuranceNumber { get; } = new PiiCategoriesExclude(JpSocialInsuranceNumberValue); + /// JP My Number Corporate. + public static PiiCategoriesExclude JpMyNumberCorporate { get; } = new PiiCategoriesExclude(JpMyNumberCorporateValue); + /// JP My Number Personal. + public static PiiCategoriesExclude JpMyNumberPersonal { get; } = new PiiCategoriesExclude(JpMyNumberPersonalValue); + /// JP Residence Card Number. + public static PiiCategoriesExclude JpResidenceCardNumber { get; } = new PiiCategoriesExclude(JpResidenceCardNumberValue); + /// LV Personal Code. + public static PiiCategoriesExclude LvPersonalCode { get; } = new PiiCategoriesExclude(LvPersonalCodeValue); + /// LT Personal Code. + public static PiiCategoriesExclude LtPersonalCode { get; } = new PiiCategoriesExclude(LtPersonalCodeValue); + /// LU National Identification Number Natural. + public static PiiCategoriesExclude LuNationalIdentificationNumberNatural { get; } = new PiiCategoriesExclude(LuNationalIdentificationNumberNaturalValue); + /// LU National Identification Number Non Natural. + public static PiiCategoriesExclude LuNationalIdentificationNumberNonNatural { get; } = new PiiCategoriesExclude(LuNationalIdentificationNumberNonNaturalValue); + /// MY Identity Card Number. + public static PiiCategoriesExclude MyIdentityCardNumber { get; } = new PiiCategoriesExclude(MyIdentityCardNumberValue); + /// MT Identity Card Number. + public static PiiCategoriesExclude MtIdentityCardNumber { get; } = new PiiCategoriesExclude(MtIdentityCardNumberValue); + /// MT Tax ID Number. + public static PiiCategoriesExclude MtTaxIdNumber { get; } = new PiiCategoriesExclude(MtTaxIdNumberValue); + /// NL Citizens Service Number. + public static PiiCategoriesExclude NlCitizensServiceNumber { get; } = new PiiCategoriesExclude(NlCitizensServiceNumberValue); + /// NL Citizens Service Number V2. + public static PiiCategoriesExclude NlCitizensServiceNumberV2 { get; } = new PiiCategoriesExclude(NlCitizensServiceNumberV2Value); + /// NL Tax Identification Number. + public static PiiCategoriesExclude NlTaxIdentificationNumber { get; } = new PiiCategoriesExclude(NlTaxIdentificationNumberValue); + /// NL Value Added Tax Number. + public static PiiCategoriesExclude NlValueAddedTaxNumber { get; } = new PiiCategoriesExclude(NlValueAddedTaxNumberValue); + /// NZ Bank Account Number. + public static PiiCategoriesExclude NzBankAccountNumber { get; } = new PiiCategoriesExclude(NzBankAccountNumberValue); + /// NZ Driver's License Number. + public static PiiCategoriesExclude NzDriversLicenseNumber { get; } = new PiiCategoriesExclude(NzDriversLicenseNumberValue); + /// NZ Inland Revenue Number. + public static PiiCategoriesExclude NzInlandRevenueNumber { get; } = new PiiCategoriesExclude(NzInlandRevenueNumberValue); + /// NZ Ministry Of Health Number. + public static PiiCategoriesExclude NzMinistryOfHealthNumber { get; } = new PiiCategoriesExclude(NzMinistryOfHealthNumberValue); + /// NZ Social Welfare Number. + public static PiiCategoriesExclude NzSocialWelfareNumber { get; } = new PiiCategoriesExclude(NzSocialWelfareNumberValue); + /// NO Identity Number. + public static PiiCategoriesExclude NoIdentityNumber { get; } = new PiiCategoriesExclude(NoIdentityNumberValue); + /// PH Unified Multi Purpose ID Number. + public static PiiCategoriesExclude PhUnifiedMultiPurposeIdNumber { get; } = new PiiCategoriesExclude(PhUnifiedMultiPurposeIdNumberValue); + /// PL Identity Card. + public static PiiCategoriesExclude PlIdentityCard { get; } = new PiiCategoriesExclude(PlIdentityCardValue); + /// PL National ID. + public static PiiCategoriesExclude PlNationalId { get; } = new PiiCategoriesExclude(PlNationalIdValue); + /// PL National ID V2. + public static PiiCategoriesExclude PlNationalIdV2 { get; } = new PiiCategoriesExclude(PlNationalIdV2Value); + /// PL Passport Number. + public static PiiCategoriesExclude PlPassportNumber { get; } = new PiiCategoriesExclude(PlPassportNumberValue); + /// PL Tax Identification Number. + public static PiiCategoriesExclude PlTaxIdentificationNumber { get; } = new PiiCategoriesExclude(PlTaxIdentificationNumberValue); + /// PL REGON Number. + public static PiiCategoriesExclude PlRegonNumber { get; } = new PiiCategoriesExclude(PlRegonNumberValue); + /// PT Citizen Card Number. + public static PiiCategoriesExclude PtCitizenCardNumber { get; } = new PiiCategoriesExclude(PtCitizenCardNumberValue); + /// PT Citizen Card Number V2. + public static PiiCategoriesExclude PtCitizenCardNumberV2 { get; } = new PiiCategoriesExclude(PtCitizenCardNumberV2Value); + /// PT Tax Identification Number. + public static PiiCategoriesExclude PtTaxIdentificationNumber { get; } = new PiiCategoriesExclude(PtTaxIdentificationNumberValue); + /// RO Personal Numerical Code. + public static PiiCategoriesExclude RoPersonalNumericalCode { get; } = new PiiCategoriesExclude(RoPersonalNumericalCodeValue); + /// RU Passport Number Domestic. + public static PiiCategoriesExclude RuPassportNumberDomestic { get; } = new PiiCategoriesExclude(RuPassportNumberDomesticValue); + /// RU Passport Number International. + public static PiiCategoriesExclude RuPassportNumberInternational { get; } = new PiiCategoriesExclude(RuPassportNumberInternationalValue); + /// SA National ID. + public static PiiCategoriesExclude SaNationalId { get; } = new PiiCategoriesExclude(SaNationalIdValue); + /// SG National Registration Identity Card Number. + public static PiiCategoriesExclude SgNationalRegistrationIdentityCardNumber { get; } = new PiiCategoriesExclude(SgNationalRegistrationIdentityCardNumberValue); + /// SK Personal Number. + public static PiiCategoriesExclude SkPersonalNumber { get; } = new PiiCategoriesExclude(SkPersonalNumberValue); + /// SI Tax Identification Number. + public static PiiCategoriesExclude SiTaxIdentificationNumber { get; } = new PiiCategoriesExclude(SiTaxIdentificationNumberValue); + /// SI Unique Master Citizen Number. + public static PiiCategoriesExclude SiUniqueMasterCitizenNumber { get; } = new PiiCategoriesExclude(SiUniqueMasterCitizenNumberValue); + /// ZA Identification Number. + public static PiiCategoriesExclude ZaIdentificationNumber { get; } = new PiiCategoriesExclude(ZaIdentificationNumberValue); + /// KR Resident Registration Number. + public static PiiCategoriesExclude KrResidentRegistrationNumber { get; } = new PiiCategoriesExclude(KrResidentRegistrationNumberValue); + /// ES DNI. + public static PiiCategoriesExclude EsDni { get; } = new PiiCategoriesExclude(EsDniValue); + /// ES Social Security Number. + public static PiiCategoriesExclude EsSocialSecurityNumber { get; } = new PiiCategoriesExclude(EsSocialSecurityNumberValue); + /// ES Tax Identification Number. + public static PiiCategoriesExclude EsTaxIdentificationNumber { get; } = new PiiCategoriesExclude(EsTaxIdentificationNumberValue); + /// SQL Server Connection String. + public static PiiCategoriesExclude SqlServerConnectionString { get; } = new PiiCategoriesExclude(SqlServerConnectionStringValue); + /// SE National ID. + public static PiiCategoriesExclude SeNationalId { get; } = new PiiCategoriesExclude(SeNationalIdValue); + /// SE National ID V2. + public static PiiCategoriesExclude SeNationalIdV2 { get; } = new PiiCategoriesExclude(SeNationalIdV2Value); + /// SE Passport Number. + public static PiiCategoriesExclude SePassportNumber { get; } = new PiiCategoriesExclude(SePassportNumberValue); + /// SE Tax Identification Number. + public static PiiCategoriesExclude SeTaxIdentificationNumber { get; } = new PiiCategoriesExclude(SeTaxIdentificationNumberValue); + /// SWIFT Code. + public static PiiCategoriesExclude SwiftCode { get; } = new PiiCategoriesExclude(SwiftCodeValue); + /// CH Social Security Number. + public static PiiCategoriesExclude ChSocialSecurityNumber { get; } = new PiiCategoriesExclude(ChSocialSecurityNumberValue); + /// TW National ID. + public static PiiCategoriesExclude TwNationalId { get; } = new PiiCategoriesExclude(TwNationalIdValue); + /// TW Passport Number. + public static PiiCategoriesExclude TwPassportNumber { get; } = new PiiCategoriesExclude(TwPassportNumberValue); + /// TW Resident Certificate. + public static PiiCategoriesExclude TwResidentCertificate { get; } = new PiiCategoriesExclude(TwResidentCertificateValue); + /// TH Population Identification Code. + public static PiiCategoriesExclude ThPopulationIdentificationCode { get; } = new PiiCategoriesExclude(ThPopulationIdentificationCodeValue); + /// TR National Identification Number. + public static PiiCategoriesExclude TrNationalIdentificationNumber { get; } = new PiiCategoriesExclude(TrNationalIdentificationNumberValue); + /// UK Driver's License Number. + public static PiiCategoriesExclude UkDriversLicenseNumber { get; } = new PiiCategoriesExclude(UkDriversLicenseNumberValue); + /// UK Electoral Roll Number. + public static PiiCategoriesExclude UkElectoralRollNumber { get; } = new PiiCategoriesExclude(UkElectoralRollNumberValue); + /// UK National Health Number. + public static PiiCategoriesExclude UkNationalHealthNumber { get; } = new PiiCategoriesExclude(UkNationalHealthNumberValue); + /// UK National Insurance Number. + public static PiiCategoriesExclude UkNationalInsuranceNumber { get; } = new PiiCategoriesExclude(UkNationalInsuranceNumberValue); + /// UK Unique Taxpayer Number. + public static PiiCategoriesExclude UkUniqueTaxpayerNumber { get; } = new PiiCategoriesExclude(UkUniqueTaxpayerNumberValue); + /// US UK Passport Number. + public static PiiCategoriesExclude UsUkPassportNumber { get; } = new PiiCategoriesExclude(UsUkPassportNumberValue); + /// US Bank Account Number. + public static PiiCategoriesExclude UsBankAccountNumber { get; } = new PiiCategoriesExclude(UsBankAccountNumberValue); + /// US Driver's License Number. + public static PiiCategoriesExclude UsDriversLicenseNumber { get; } = new PiiCategoriesExclude(UsDriversLicenseNumberValue); + /// US Individual Taxpayer Identification. + public static PiiCategoriesExclude UsIndividualTaxpayerIdentification { get; } = new PiiCategoriesExclude(UsIndividualTaxpayerIdentificationValue); + /// US Social Security Number. + public static PiiCategoriesExclude UsSocialSecurityNumber { get; } = new PiiCategoriesExclude(UsSocialSecurityNumberValue); + /// UA Passport Number Domestic. + public static PiiCategoriesExclude UaPassportNumberDomestic { get; } = new PiiCategoriesExclude(UaPassportNumberDomesticValue); + /// UA Passport Number International. + public static PiiCategoriesExclude UaPassportNumberInternational { get; } = new PiiCategoriesExclude(UaPassportNumberInternationalValue); + /// Organization. + public static PiiCategoriesExclude Organization { get; } = new PiiCategoriesExclude(OrganizationValue); + /// Email. + public static PiiCategoriesExclude Email { get; } = new PiiCategoriesExclude(EmailValue); + /// URL. + public static PiiCategoriesExclude URL { get; } = new PiiCategoriesExclude(URLValue); + /// Age. + public static PiiCategoriesExclude Age { get; } = new PiiCategoriesExclude(AgeValue); + /// Phone Number. + public static PiiCategoriesExclude PhoneNumber { get; } = new PiiCategoriesExclude(PhoneNumberValue); + /// IP Address. + public static PiiCategoriesExclude IPAddress { get; } = new PiiCategoriesExclude(IPAddressValue); + /// Date. + public static PiiCategoriesExclude Date { get; } = new PiiCategoriesExclude(DateValue); + /// Person. + public static PiiCategoriesExclude Person { get; } = new PiiCategoriesExclude(PersonValue); + /// Address. + public static PiiCategoriesExclude Address { get; } = new PiiCategoriesExclude(AddressValue); + /// Determines if two values are the same. + public static bool operator ==(PiiCategoriesExclude left, PiiCategoriesExclude right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PiiCategoriesExclude left, PiiCategoriesExclude right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PiiCategoriesExclude(string value) => new PiiCategoriesExclude(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PiiCategoriesExclude other && Equals(other); + /// + public bool Equals(PiiCategoriesExclude other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiCategory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiCategory.cs new file mode 100644 index 000000000000..fd0d8306060f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiCategory.cs @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// (Optional) describes the PII categories to return. + public readonly partial struct PiiCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PiiCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AbaRoutingNumberValue = "ABARoutingNumber"; + private const string ArNationalIdentityNumberValue = "ARNationalIdentityNumber"; + private const string AuBankAccountNumberValue = "AUBankAccountNumber"; + private const string AuDriversLicenseNumberValue = "AUDriversLicenseNumber"; + private const string AuMedicalAccountNumberValue = "AUMedicalAccountNumber"; + private const string AuPassportNumberValue = "AUPassportNumber"; + private const string AuTaxFileNumberValue = "AUTaxFileNumber"; + private const string AuBusinessNumberValue = "AUBusinessNumber"; + private const string AuCompanyNumberValue = "AUCompanyNumber"; + private const string AtIdentityCardValue = "ATIdentityCard"; + private const string AtTaxIdentificationNumberValue = "ATTaxIdentificationNumber"; + private const string AtValueAddedTaxNumberValue = "ATValueAddedTaxNumber"; + private const string AzureDocumentDbauthKeyValue = "AzureDocumentDBAuthKey"; + private const string AzureIaasDatabaseConnectionAndSqlStringValue = "AzureIAASDatabaseConnectionAndSQLString"; + private const string AzureIoTConnectionStringValue = "AzureIoTConnectionString"; + private const string AzurePublishSettingPasswordValue = "AzurePublishSettingPassword"; + private const string AzureRedisCacheStringValue = "AzureRedisCacheString"; + private const string AzureSasValue = "AzureSAS"; + private const string AzureServiceBusStringValue = "AzureServiceBusString"; + private const string AzureStorageAccountKeyValue = "AzureStorageAccountKey"; + private const string AzureStorageAccountGenericValue = "AzureStorageAccountGeneric"; + private const string BeNationalNumberValue = "BENationalNumber"; + private const string BeNationalNumberV2Value = "BENationalNumberV2"; + private const string BeValueAddedTaxNumberValue = "BEValueAddedTaxNumber"; + private const string BrCpfNumberValue = "BRCPFNumber"; + private const string BrLegalEntityNumberValue = "BRLegalEntityNumber"; + private const string BrNationalIdRgValue = "BRNationalIDRG"; + private const string BgUniformCivilNumberValue = "BGUniformCivilNumber"; + private const string CaBankAccountNumberValue = "CABankAccountNumber"; + private const string CaDriversLicenseNumberValue = "CADriversLicenseNumber"; + private const string CaHealthServiceNumberValue = "CAHealthServiceNumber"; + private const string CaPassportNumberValue = "CAPassportNumber"; + private const string CaPersonalHealthIdentificationValue = "CAPersonalHealthIdentification"; + private const string CaSocialInsuranceNumberValue = "CASocialInsuranceNumber"; + private const string ClIdentityCardNumberValue = "CLIdentityCardNumber"; + private const string CnResidentIdentityCardNumberValue = "CNResidentIdentityCardNumber"; + private const string CreditCardNumberValue = "CreditCardNumber"; + private const string HrIdentityCardNumberValue = "HRIdentityCardNumber"; + private const string HrNationalIdNumberValue = "HRNationalIDNumber"; + private const string HrPersonalIdentificationNumberValue = "HRPersonalIdentificationNumber"; + private const string HrPersonalIdentificationOIBNumberV2Value = "HRPersonalIdentificationOIBNumberV2"; + private const string CyIdentityCardValue = "CYIdentityCard"; + private const string CyTaxIdentificationNumberValue = "CYTaxIdentificationNumber"; + private const string CzPersonalIdentityNumberValue = "CZPersonalIdentityNumber"; + private const string CzPersonalIdentityV2Value = "CZPersonalIdentityV2"; + private const string DkPersonalIdentificationNumberValue = "DKPersonalIdentificationNumber"; + private const string DkPersonalIdentificationV2Value = "DKPersonalIdentificationV2"; + private const string DrugEnforcementAgencyNumberValue = "DrugEnforcementAgencyNumber"; + private const string EePersonalIdentificationCodeValue = "EEPersonalIdentificationCode"; + private const string EuDebitCardNumberValue = "EUDebitCardNumber"; + private const string EuDriversLicenseNumberValue = "EUDriversLicenseNumber"; + private const string EuGpsCoordinatesValue = "EUGPSCoordinates"; + private const string EuNationalIdentificationNumberValue = "EUNationalIdentificationNumber"; + private const string EuPassportNumberValue = "EUPassportNumber"; + private const string EuSocialSecurityNumberValue = "EUSocialSecurityNumber"; + private const string EuTaxIdentificationNumberValue = "EUTaxIdentificationNumber"; + private const string FiEuropeanHealthNumberValue = "FIEuropeanHealthNumber"; + private const string FiNationalIdValue = "FINationalID"; + private const string FiNationalIdV2Value = "FINationalIDV2"; + private const string FiPassportNumberValue = "FIPassportNumber"; + private const string FrDriversLicenseNumberValue = "FRDriversLicenseNumber"; + private const string FrHealthInsuranceNumberValue = "FRHealthInsuranceNumber"; + private const string FrNationalIdValue = "FRNationalID"; + private const string FrPassportNumberValue = "FRPassportNumber"; + private const string FrSocialSecurityNumberValue = "FRSocialSecurityNumber"; + private const string FrTaxIdentificationNumberValue = "FRTaxIdentificationNumber"; + private const string FrValueAddedTaxNumberValue = "FRValueAddedTaxNumber"; + private const string DeDriversLicenseNumberValue = "DEDriversLicenseNumber"; + private const string DePassportNumberValue = "DEPassportNumber"; + private const string DeIdentityCardNumberValue = "DEIdentityCardNumber"; + private const string DeTaxIdentificationNumberValue = "DETaxIdentificationNumber"; + private const string DeValueAddedNumberValue = "DEValueAddedNumber"; + private const string GrNationalIdCardValue = "GRNationalIDCard"; + private const string GrNationalIdV2Value = "GRNationalIDV2"; + private const string GrTaxIdentificationNumberValue = "GRTaxIdentificationNumber"; + private const string HkIdentityCardNumberValue = "HKIdentityCardNumber"; + private const string HuValueAddedNumberValue = "HUValueAddedNumber"; + private const string HuPersonalIdentificationNumberValue = "HUPersonalIdentificationNumber"; + private const string HuTaxIdentificationNumberValue = "HUTaxIdentificationNumber"; + private const string InPermanentAccountValue = "INPermanentAccount"; + private const string InUniqueIdentificationNumberValue = "INUniqueIdentificationNumber"; + private const string IdIdentityCardNumberValue = "IDIdentityCardNumber"; + private const string InternationalBankingAccountNumberValue = "InternationalBankingAccountNumber"; + private const string IePersonalPublicServiceNumberValue = "IEPersonalPublicServiceNumber"; + private const string IePersonalPublicServiceNumberV2Value = "IEPersonalPublicServiceNumberV2"; + private const string IlBankAccountNumberValue = "ILBankAccountNumber"; + private const string IlNationalIdValue = "ILNationalID"; + private const string ItDriversLicenseNumberValue = "ITDriversLicenseNumber"; + private const string ItFiscalCodeValue = "ITFiscalCode"; + private const string ItValueAddedTaxNumberValue = "ITValueAddedTaxNumber"; + private const string JpBankAccountNumberValue = "JPBankAccountNumber"; + private const string JpDriversLicenseNumberValue = "JPDriversLicenseNumber"; + private const string JpPassportNumberValue = "JPPassportNumber"; + private const string JpResidentRegistrationNumberValue = "JPResidentRegistrationNumber"; + private const string JpSocialInsuranceNumberValue = "JPSocialInsuranceNumber"; + private const string JpMyNumberCorporateValue = "JPMyNumberCorporate"; + private const string JpMyNumberPersonalValue = "JPMyNumberPersonal"; + private const string JpResidenceCardNumberValue = "JPResidenceCardNumber"; + private const string LvPersonalCodeValue = "LVPersonalCode"; + private const string LtPersonalCodeValue = "LTPersonalCode"; + private const string LuNationalIdentificationNumberNaturalValue = "LUNationalIdentificationNumberNatural"; + private const string LuNationalIdentificationNumberNonNaturalValue = "LUNationalIdentificationNumberNonNatural"; + private const string MyIdentityCardNumberValue = "MYIdentityCardNumber"; + private const string MtIdentityCardNumberValue = "MTIdentityCardNumber"; + private const string MtTaxIdNumberValue = "MTTaxIDNumber"; + private const string NlCitizensServiceNumberValue = "NLCitizensServiceNumber"; + private const string NlCitizensServiceNumberV2Value = "NLCitizensServiceNumberV2"; + private const string NlTaxIdentificationNumberValue = "NLTaxIdentificationNumber"; + private const string NlValueAddedTaxNumberValue = "NLValueAddedTaxNumber"; + private const string NzBankAccountNumberValue = "NZBankAccountNumber"; + private const string NzDriversLicenseNumberValue = "NZDriversLicenseNumber"; + private const string NzInlandRevenueNumberValue = "NZInlandRevenueNumber"; + private const string NzMinistryOfHealthNumberValue = "NZMinistryOfHealthNumber"; + private const string NzSocialWelfareNumberValue = "NZSocialWelfareNumber"; + private const string NoIdentityNumberValue = "NOIdentityNumber"; + private const string PhUnifiedMultiPurposeIdNumberValue = "PHUnifiedMultiPurposeIDNumber"; + private const string PlIdentityCardValue = "PLIdentityCard"; + private const string PlNationalIdValue = "PLNationalID"; + private const string PlNationalIdV2Value = "PLNationalIDV2"; + private const string PlPassportNumberValue = "PLPassportNumber"; + private const string PlTaxIdentificationNumberValue = "PLTaxIdentificationNumber"; + private const string PlRegonNumberValue = "PLREGONNumber"; + private const string PtCitizenCardNumberValue = "PTCitizenCardNumber"; + private const string PtCitizenCardNumberV2Value = "PTCitizenCardNumberV2"; + private const string PtTaxIdentificationNumberValue = "PTTaxIdentificationNumber"; + private const string RoPersonalNumericalCodeValue = "ROPersonalNumericalCode"; + private const string RuPassportNumberDomesticValue = "RUPassportNumberDomestic"; + private const string RuPassportNumberInternationalValue = "RUPassportNumberInternational"; + private const string SaNationalIdValue = "SANationalID"; + private const string SgNationalRegistrationIdentityCardNumberValue = "SGNationalRegistrationIdentityCardNumber"; + private const string SkPersonalNumberValue = "SKPersonalNumber"; + private const string SiTaxIdentificationNumberValue = "SITaxIdentificationNumber"; + private const string SiUniqueMasterCitizenNumberValue = "SIUniqueMasterCitizenNumber"; + private const string ZaIdentificationNumberValue = "ZAIdentificationNumber"; + private const string KrResidentRegistrationNumberValue = "KRResidentRegistrationNumber"; + private const string EsDniValue = "ESDNI"; + private const string EsSocialSecurityNumberValue = "ESSocialSecurityNumber"; + private const string EsTaxIdentificationNumberValue = "ESTaxIdentificationNumber"; + private const string SqlServerConnectionStringValue = "SQLServerConnectionString"; + private const string SeNationalIdValue = "SENationalID"; + private const string SeNationalIdV2Value = "SENationalIDV2"; + private const string SePassportNumberValue = "SEPassportNumber"; + private const string SeTaxIdentificationNumberValue = "SETaxIdentificationNumber"; + private const string SwiftCodeValue = "SWIFTCode"; + private const string ChSocialSecurityNumberValue = "CHSocialSecurityNumber"; + private const string TwNationalIdValue = "TWNationalID"; + private const string TwPassportNumberValue = "TWPassportNumber"; + private const string TwResidentCertificateValue = "TWResidentCertificate"; + private const string ThPopulationIdentificationCodeValue = "THPopulationIdentificationCode"; + private const string TrNationalIdentificationNumberValue = "TRNationalIdentificationNumber"; + private const string UkDriversLicenseNumberValue = "UKDriversLicenseNumber"; + private const string UkElectoralRollNumberValue = "UKElectoralRollNumber"; + private const string UkNationalHealthNumberValue = "UKNationalHealthNumber"; + private const string UkNationalInsuranceNumberValue = "UKNationalInsuranceNumber"; + private const string UkUniqueTaxpayerNumberValue = "UKUniqueTaxpayerNumber"; + private const string UsUkPassportNumberValue = "USUKPassportNumber"; + private const string UsBankAccountNumberValue = "USBankAccountNumber"; + private const string UsDriversLicenseNumberValue = "USDriversLicenseNumber"; + private const string UsIndividualTaxpayerIdentificationValue = "USIndividualTaxpayerIdentification"; + private const string UsSocialSecurityNumberValue = "USSocialSecurityNumber"; + private const string UaPassportNumberDomesticValue = "UAPassportNumberDomestic"; + private const string UaPassportNumberInternationalValue = "UAPassportNumberInternational"; + private const string OrganizationValue = "Organization"; + private const string EmailValue = "Email"; + private const string URLValue = "URL"; + private const string AgeValue = "Age"; + private const string PhoneNumberValue = "PhoneNumber"; + private const string IPAddressValue = "IPAddress"; + private const string DateValue = "Date"; + private const string PersonValue = "Person"; + private const string AddressValue = "Address"; + private const string AllValue = "All"; + private const string DefaultValue = "Default"; + + /// ABA Routing number. + public static PiiCategory AbaRoutingNumber { get; } = new PiiCategory(AbaRoutingNumberValue); + /// AR National Identity Number. + public static PiiCategory ArNationalIdentityNumber { get; } = new PiiCategory(ArNationalIdentityNumberValue); + /// AT Identity Card. + public static PiiCategory AuBankAccountNumber { get; } = new PiiCategory(AuBankAccountNumberValue); + /// AU Driver's License Number. + public static PiiCategory AuDriversLicenseNumber { get; } = new PiiCategory(AuDriversLicenseNumberValue); + /// AU Medical Account Number. + public static PiiCategory AuMedicalAccountNumber { get; } = new PiiCategory(AuMedicalAccountNumberValue); + /// AU Passport Number. + public static PiiCategory AuPassportNumber { get; } = new PiiCategory(AuPassportNumberValue); + /// AU Tax File Number. + public static PiiCategory AuTaxFileNumber { get; } = new PiiCategory(AuTaxFileNumberValue); + /// AU Business Number. + public static PiiCategory AuBusinessNumber { get; } = new PiiCategory(AuBusinessNumberValue); + /// AU Company Number. + public static PiiCategory AuCompanyNumber { get; } = new PiiCategory(AuCompanyNumberValue); + /// AT Identity Card. + public static PiiCategory AtIdentityCard { get; } = new PiiCategory(AtIdentityCardValue); + /// AT Tax Identification Number. + public static PiiCategory AtTaxIdentificationNumber { get; } = new PiiCategory(AtTaxIdentificationNumberValue); + /// AT Value Added Tax Number. + public static PiiCategory AtValueAddedTaxNumber { get; } = new PiiCategory(AtValueAddedTaxNumberValue); + /// Azure Document DB Auth Key. + public static PiiCategory AzureDocumentDbauthKey { get; } = new PiiCategory(AzureDocumentDbauthKeyValue); + /// Azure IAAS Database Connection And SQL String. + public static PiiCategory AzureIaasDatabaseConnectionAndSqlString { get; } = new PiiCategory(AzureIaasDatabaseConnectionAndSqlStringValue); + /// Azure IoT Connection String. + public static PiiCategory AzureIoTConnectionString { get; } = new PiiCategory(AzureIoTConnectionStringValue); + /// Azure Publish Setting Password. + public static PiiCategory AzurePublishSettingPassword { get; } = new PiiCategory(AzurePublishSettingPasswordValue); + /// Azure Redis Cache String. + public static PiiCategory AzureRedisCacheString { get; } = new PiiCategory(AzureRedisCacheStringValue); + /// Azure SAS. + public static PiiCategory AzureSas { get; } = new PiiCategory(AzureSasValue); + /// Azure Service Bus String. + public static PiiCategory AzureServiceBusString { get; } = new PiiCategory(AzureServiceBusStringValue); + /// Azure Storage Account Key. + public static PiiCategory AzureStorageAccountKey { get; } = new PiiCategory(AzureStorageAccountKeyValue); + /// Azure Storage Account Generic. + public static PiiCategory AzureStorageAccountGeneric { get; } = new PiiCategory(AzureStorageAccountGenericValue); + /// BE National Number. + public static PiiCategory BeNationalNumber { get; } = new PiiCategory(BeNationalNumberValue); + /// BE National Number V2. + public static PiiCategory BeNationalNumberV2 { get; } = new PiiCategory(BeNationalNumberV2Value); + /// BE Value Added Tax Number. + public static PiiCategory BeValueAddedTaxNumber { get; } = new PiiCategory(BeValueAddedTaxNumberValue); + /// BR CPF Number. + public static PiiCategory BrCpfNumber { get; } = new PiiCategory(BrCpfNumberValue); + /// BR Legal Entity Number. + public static PiiCategory BrLegalEntityNumber { get; } = new PiiCategory(BrLegalEntityNumberValue); + /// BR National ID RG. + public static PiiCategory BrNationalIdRg { get; } = new PiiCategory(BrNationalIdRgValue); + /// BG Uniform Civil Number. + public static PiiCategory BgUniformCivilNumber { get; } = new PiiCategory(BgUniformCivilNumberValue); + /// CA Bank Account Number. + public static PiiCategory CaBankAccountNumber { get; } = new PiiCategory(CaBankAccountNumberValue); + /// CA Driver's License Number. + public static PiiCategory CaDriversLicenseNumber { get; } = new PiiCategory(CaDriversLicenseNumberValue); + /// CA Health Service Number. + public static PiiCategory CaHealthServiceNumber { get; } = new PiiCategory(CaHealthServiceNumberValue); + /// CA Passport Number. + public static PiiCategory CaPassportNumber { get; } = new PiiCategory(CaPassportNumberValue); + /// CA Personal Health Identification. + public static PiiCategory CaPersonalHealthIdentification { get; } = new PiiCategory(CaPersonalHealthIdentificationValue); + /// CA Social Insurance Number. + public static PiiCategory CaSocialInsuranceNumber { get; } = new PiiCategory(CaSocialInsuranceNumberValue); + /// CL Identity Card Number. + public static PiiCategory ClIdentityCardNumber { get; } = new PiiCategory(ClIdentityCardNumberValue); + /// CN Resident Identity Card Number. + public static PiiCategory CnResidentIdentityCardNumber { get; } = new PiiCategory(CnResidentIdentityCardNumberValue); + /// Credit Card Number. + public static PiiCategory CreditCardNumber { get; } = new PiiCategory(CreditCardNumberValue); + /// HR Identity Card Number. + public static PiiCategory HrIdentityCardNumber { get; } = new PiiCategory(HrIdentityCardNumberValue); + /// HR National ID Number. + public static PiiCategory HrNationalIdNumber { get; } = new PiiCategory(HrNationalIdNumberValue); + /// HR Personal Identification Number. + public static PiiCategory HrPersonalIdentificationNumber { get; } = new PiiCategory(HrPersonalIdentificationNumberValue); + /// HR Personal Identification OIB Number V2. + public static PiiCategory HrPersonalIdentificationOIBNumberV2 { get; } = new PiiCategory(HrPersonalIdentificationOIBNumberV2Value); + /// CY Identity Card. + public static PiiCategory CyIdentityCard { get; } = new PiiCategory(CyIdentityCardValue); + /// CY Tax Identification Number. + public static PiiCategory CyTaxIdentificationNumber { get; } = new PiiCategory(CyTaxIdentificationNumberValue); + /// CZ Personal Identity Number. + public static PiiCategory CzPersonalIdentityNumber { get; } = new PiiCategory(CzPersonalIdentityNumberValue); + /// CZ Personal Identity V2. + public static PiiCategory CzPersonalIdentityV2 { get; } = new PiiCategory(CzPersonalIdentityV2Value); + /// DK Personal Identification Number. + public static PiiCategory DkPersonalIdentificationNumber { get; } = new PiiCategory(DkPersonalIdentificationNumberValue); + /// DK Personal Identification V2. + public static PiiCategory DkPersonalIdentificationV2 { get; } = new PiiCategory(DkPersonalIdentificationV2Value); + /// Drug Enforcement Agency Number. + public static PiiCategory DrugEnforcementAgencyNumber { get; } = new PiiCategory(DrugEnforcementAgencyNumberValue); + /// EE Personal Identification Code. + public static PiiCategory EePersonalIdentificationCode { get; } = new PiiCategory(EePersonalIdentificationCodeValue); + /// EU Debit Card Number. + public static PiiCategory EuDebitCardNumber { get; } = new PiiCategory(EuDebitCardNumberValue); + /// EU Driver's License Number. + public static PiiCategory EuDriversLicenseNumber { get; } = new PiiCategory(EuDriversLicenseNumberValue); + /// EU GPS Coordinates. + public static PiiCategory EuGpsCoordinates { get; } = new PiiCategory(EuGpsCoordinatesValue); + /// EU National Identification Number. + public static PiiCategory EuNationalIdentificationNumber { get; } = new PiiCategory(EuNationalIdentificationNumberValue); + /// EU Passport Number. + public static PiiCategory EuPassportNumber { get; } = new PiiCategory(EuPassportNumberValue); + /// EU Social Security Number. + public static PiiCategory EuSocialSecurityNumber { get; } = new PiiCategory(EuSocialSecurityNumberValue); + /// EU Tax Identification Number. + public static PiiCategory EuTaxIdentificationNumber { get; } = new PiiCategory(EuTaxIdentificationNumberValue); + /// FI European Health Number. + public static PiiCategory FiEuropeanHealthNumber { get; } = new PiiCategory(FiEuropeanHealthNumberValue); + /// FI National ID. + public static PiiCategory FiNationalId { get; } = new PiiCategory(FiNationalIdValue); + /// FI National ID V2. + public static PiiCategory FiNationalIdV2 { get; } = new PiiCategory(FiNationalIdV2Value); + /// FI Passport Number. + public static PiiCategory FiPassportNumber { get; } = new PiiCategory(FiPassportNumberValue); + /// FR Driver's License Number. + public static PiiCategory FrDriversLicenseNumber { get; } = new PiiCategory(FrDriversLicenseNumberValue); + /// FR Health Insurance Number. + public static PiiCategory FrHealthInsuranceNumber { get; } = new PiiCategory(FrHealthInsuranceNumberValue); + /// FR National ID. + public static PiiCategory FrNationalId { get; } = new PiiCategory(FrNationalIdValue); + /// FR Passport Number. + public static PiiCategory FrPassportNumber { get; } = new PiiCategory(FrPassportNumberValue); + /// FR Social Security Number. + public static PiiCategory FrSocialSecurityNumber { get; } = new PiiCategory(FrSocialSecurityNumberValue); + /// FR Tax Identification Number. + public static PiiCategory FrTaxIdentificationNumber { get; } = new PiiCategory(FrTaxIdentificationNumberValue); + /// FR Value Added Tax Number. + public static PiiCategory FrValueAddedTaxNumber { get; } = new PiiCategory(FrValueAddedTaxNumberValue); + /// DE Driver's License Number. + public static PiiCategory DeDriversLicenseNumber { get; } = new PiiCategory(DeDriversLicenseNumberValue); + /// DE Passport Number. + public static PiiCategory DePassportNumber { get; } = new PiiCategory(DePassportNumberValue); + /// DE Identity Card Number. + public static PiiCategory DeIdentityCardNumber { get; } = new PiiCategory(DeIdentityCardNumberValue); + /// DE Tax Identification Number. + public static PiiCategory DeTaxIdentificationNumber { get; } = new PiiCategory(DeTaxIdentificationNumberValue); + /// DE Value Added Number. + public static PiiCategory DeValueAddedNumber { get; } = new PiiCategory(DeValueAddedNumberValue); + /// GR National ID Card. + public static PiiCategory GrNationalIdCard { get; } = new PiiCategory(GrNationalIdCardValue); + /// GR National ID V2. + public static PiiCategory GrNationalIdV2 { get; } = new PiiCategory(GrNationalIdV2Value); + /// GR Tax Identification Number. + public static PiiCategory GrTaxIdentificationNumber { get; } = new PiiCategory(GrTaxIdentificationNumberValue); + /// HK Identity Card Number. + public static PiiCategory HkIdentityCardNumber { get; } = new PiiCategory(HkIdentityCardNumberValue); + /// HU Value Added Number. + public static PiiCategory HuValueAddedNumber { get; } = new PiiCategory(HuValueAddedNumberValue); + /// HU Personal Identification Number. + public static PiiCategory HuPersonalIdentificationNumber { get; } = new PiiCategory(HuPersonalIdentificationNumberValue); + /// HU Tax Identification Number. + public static PiiCategory HuTaxIdentificationNumber { get; } = new PiiCategory(HuTaxIdentificationNumberValue); + /// IN Permanent Account. + public static PiiCategory InPermanentAccount { get; } = new PiiCategory(InPermanentAccountValue); + /// IN Unique Identification Number. + public static PiiCategory InUniqueIdentificationNumber { get; } = new PiiCategory(InUniqueIdentificationNumberValue); + /// ID Identity Card Number. + public static PiiCategory IdIdentityCardNumber { get; } = new PiiCategory(IdIdentityCardNumberValue); + /// International Banking Account Number. + public static PiiCategory InternationalBankingAccountNumber { get; } = new PiiCategory(InternationalBankingAccountNumberValue); + /// IE Personal Public Service Number. + public static PiiCategory IePersonalPublicServiceNumber { get; } = new PiiCategory(IePersonalPublicServiceNumberValue); + /// IE Personal Public Service Number V2. + public static PiiCategory IePersonalPublicServiceNumberV2 { get; } = new PiiCategory(IePersonalPublicServiceNumberV2Value); + /// IL Bank Account Number. + public static PiiCategory IlBankAccountNumber { get; } = new PiiCategory(IlBankAccountNumberValue); + /// IL National ID. + public static PiiCategory IlNationalId { get; } = new PiiCategory(IlNationalIdValue); + /// IT Driver's License Number. + public static PiiCategory ItDriversLicenseNumber { get; } = new PiiCategory(ItDriversLicenseNumberValue); + /// IT Fiscal Code. + public static PiiCategory ItFiscalCode { get; } = new PiiCategory(ItFiscalCodeValue); + /// IT Value Added Tax Number. + public static PiiCategory ItValueAddedTaxNumber { get; } = new PiiCategory(ItValueAddedTaxNumberValue); + /// JP Bank Account Number. + public static PiiCategory JpBankAccountNumber { get; } = new PiiCategory(JpBankAccountNumberValue); + /// JP Driver's License Number. + public static PiiCategory JpDriversLicenseNumber { get; } = new PiiCategory(JpDriversLicenseNumberValue); + /// JP Passport Number. + public static PiiCategory JpPassportNumber { get; } = new PiiCategory(JpPassportNumberValue); + /// JP Resident Registration Number. + public static PiiCategory JpResidentRegistrationNumber { get; } = new PiiCategory(JpResidentRegistrationNumberValue); + /// JP Social Insurance Number. + public static PiiCategory JpSocialInsuranceNumber { get; } = new PiiCategory(JpSocialInsuranceNumberValue); + /// JP My Number Corporate. + public static PiiCategory JpMyNumberCorporate { get; } = new PiiCategory(JpMyNumberCorporateValue); + /// JP My Number Personal. + public static PiiCategory JpMyNumberPersonal { get; } = new PiiCategory(JpMyNumberPersonalValue); + /// JP Residence Card Number. + public static PiiCategory JpResidenceCardNumber { get; } = new PiiCategory(JpResidenceCardNumberValue); + /// LV Personal Code. + public static PiiCategory LvPersonalCode { get; } = new PiiCategory(LvPersonalCodeValue); + /// LT Personal Code. + public static PiiCategory LtPersonalCode { get; } = new PiiCategory(LtPersonalCodeValue); + /// LU National Identification Number Natural. + public static PiiCategory LuNationalIdentificationNumberNatural { get; } = new PiiCategory(LuNationalIdentificationNumberNaturalValue); + /// LU National Identification Number Non Natural. + public static PiiCategory LuNationalIdentificationNumberNonNatural { get; } = new PiiCategory(LuNationalIdentificationNumberNonNaturalValue); + /// MY Identity Card Number. + public static PiiCategory MyIdentityCardNumber { get; } = new PiiCategory(MyIdentityCardNumberValue); + /// MT Identity Card Number. + public static PiiCategory MtIdentityCardNumber { get; } = new PiiCategory(MtIdentityCardNumberValue); + /// MT Tax ID Number. + public static PiiCategory MtTaxIdNumber { get; } = new PiiCategory(MtTaxIdNumberValue); + /// NL Citizens Service Number. + public static PiiCategory NlCitizensServiceNumber { get; } = new PiiCategory(NlCitizensServiceNumberValue); + /// NL Citizens Service Number V2. + public static PiiCategory NlCitizensServiceNumberV2 { get; } = new PiiCategory(NlCitizensServiceNumberV2Value); + /// NL Tax Identification Number. + public static PiiCategory NlTaxIdentificationNumber { get; } = new PiiCategory(NlTaxIdentificationNumberValue); + /// NL Value Added Tax Number. + public static PiiCategory NlValueAddedTaxNumber { get; } = new PiiCategory(NlValueAddedTaxNumberValue); + /// NZ Bank Account Number. + public static PiiCategory NzBankAccountNumber { get; } = new PiiCategory(NzBankAccountNumberValue); + /// NZ Driver's License Number. + public static PiiCategory NzDriversLicenseNumber { get; } = new PiiCategory(NzDriversLicenseNumberValue); + /// NZ Inland Revenue Number. + public static PiiCategory NzInlandRevenueNumber { get; } = new PiiCategory(NzInlandRevenueNumberValue); + /// NZ Ministry Of Health Number. + public static PiiCategory NzMinistryOfHealthNumber { get; } = new PiiCategory(NzMinistryOfHealthNumberValue); + /// NZ Social Welfare Number. + public static PiiCategory NzSocialWelfareNumber { get; } = new PiiCategory(NzSocialWelfareNumberValue); + /// NO Identity Number. + public static PiiCategory NoIdentityNumber { get; } = new PiiCategory(NoIdentityNumberValue); + /// PH Unified Multi Purpose ID Number. + public static PiiCategory PhUnifiedMultiPurposeIdNumber { get; } = new PiiCategory(PhUnifiedMultiPurposeIdNumberValue); + /// PL Identity Card. + public static PiiCategory PlIdentityCard { get; } = new PiiCategory(PlIdentityCardValue); + /// PL National ID. + public static PiiCategory PlNationalId { get; } = new PiiCategory(PlNationalIdValue); + /// PL National ID V2. + public static PiiCategory PlNationalIdV2 { get; } = new PiiCategory(PlNationalIdV2Value); + /// PL Passport Number. + public static PiiCategory PlPassportNumber { get; } = new PiiCategory(PlPassportNumberValue); + /// PL Tax Identification Number. + public static PiiCategory PlTaxIdentificationNumber { get; } = new PiiCategory(PlTaxIdentificationNumberValue); + /// PL REGON Number. + public static PiiCategory PlRegonNumber { get; } = new PiiCategory(PlRegonNumberValue); + /// PT Citizen Card Number. + public static PiiCategory PtCitizenCardNumber { get; } = new PiiCategory(PtCitizenCardNumberValue); + /// PT Citizen Card Number V2. + public static PiiCategory PtCitizenCardNumberV2 { get; } = new PiiCategory(PtCitizenCardNumberV2Value); + /// PT Tax Identification Number. + public static PiiCategory PtTaxIdentificationNumber { get; } = new PiiCategory(PtTaxIdentificationNumberValue); + /// RO Personal Numerical Code. + public static PiiCategory RoPersonalNumericalCode { get; } = new PiiCategory(RoPersonalNumericalCodeValue); + /// RU Passport Number Domestic. + public static PiiCategory RuPassportNumberDomestic { get; } = new PiiCategory(RuPassportNumberDomesticValue); + /// RU Passport Number International. + public static PiiCategory RuPassportNumberInternational { get; } = new PiiCategory(RuPassportNumberInternationalValue); + /// SA National ID. + public static PiiCategory SaNationalId { get; } = new PiiCategory(SaNationalIdValue); + /// SG National Registration Identity Card Number. + public static PiiCategory SgNationalRegistrationIdentityCardNumber { get; } = new PiiCategory(SgNationalRegistrationIdentityCardNumberValue); + /// SK Personal Number. + public static PiiCategory SkPersonalNumber { get; } = new PiiCategory(SkPersonalNumberValue); + /// SI Tax Identification Number. + public static PiiCategory SiTaxIdentificationNumber { get; } = new PiiCategory(SiTaxIdentificationNumberValue); + /// SI Unique Master Citizen Number. + public static PiiCategory SiUniqueMasterCitizenNumber { get; } = new PiiCategory(SiUniqueMasterCitizenNumberValue); + /// ZA Identification Number. + public static PiiCategory ZaIdentificationNumber { get; } = new PiiCategory(ZaIdentificationNumberValue); + /// KR Resident Registration Number. + public static PiiCategory KrResidentRegistrationNumber { get; } = new PiiCategory(KrResidentRegistrationNumberValue); + /// ES DNI. + public static PiiCategory EsDni { get; } = new PiiCategory(EsDniValue); + /// ES Social Security Number. + public static PiiCategory EsSocialSecurityNumber { get; } = new PiiCategory(EsSocialSecurityNumberValue); + /// ES Tax Identification Number. + public static PiiCategory EsTaxIdentificationNumber { get; } = new PiiCategory(EsTaxIdentificationNumberValue); + /// SQL Server Connection String. + public static PiiCategory SqlServerConnectionString { get; } = new PiiCategory(SqlServerConnectionStringValue); + /// SE National ID. + public static PiiCategory SeNationalId { get; } = new PiiCategory(SeNationalIdValue); + /// SE National ID V2. + public static PiiCategory SeNationalIdV2 { get; } = new PiiCategory(SeNationalIdV2Value); + /// SE Passport Number. + public static PiiCategory SePassportNumber { get; } = new PiiCategory(SePassportNumberValue); + /// SE Tax Identification Number. + public static PiiCategory SeTaxIdentificationNumber { get; } = new PiiCategory(SeTaxIdentificationNumberValue); + /// SWIFT Code. + public static PiiCategory SwiftCode { get; } = new PiiCategory(SwiftCodeValue); + /// CH Social Security Number. + public static PiiCategory ChSocialSecurityNumber { get; } = new PiiCategory(ChSocialSecurityNumberValue); + /// TW National ID. + public static PiiCategory TwNationalId { get; } = new PiiCategory(TwNationalIdValue); + /// TW Passport Number. + public static PiiCategory TwPassportNumber { get; } = new PiiCategory(TwPassportNumberValue); + /// TW Resident Certificate. + public static PiiCategory TwResidentCertificate { get; } = new PiiCategory(TwResidentCertificateValue); + /// TH Population Identification Code. + public static PiiCategory ThPopulationIdentificationCode { get; } = new PiiCategory(ThPopulationIdentificationCodeValue); + /// TR National Identification Number. + public static PiiCategory TrNationalIdentificationNumber { get; } = new PiiCategory(TrNationalIdentificationNumberValue); + /// UK Driver's License Number. + public static PiiCategory UkDriversLicenseNumber { get; } = new PiiCategory(UkDriversLicenseNumberValue); + /// UK Electoral Roll Number. + public static PiiCategory UkElectoralRollNumber { get; } = new PiiCategory(UkElectoralRollNumberValue); + /// UK National Health Number. + public static PiiCategory UkNationalHealthNumber { get; } = new PiiCategory(UkNationalHealthNumberValue); + /// UK National Insurance Number. + public static PiiCategory UkNationalInsuranceNumber { get; } = new PiiCategory(UkNationalInsuranceNumberValue); + /// UK Unique Taxpayer Number. + public static PiiCategory UkUniqueTaxpayerNumber { get; } = new PiiCategory(UkUniqueTaxpayerNumberValue); + /// US UK Passport Number. + public static PiiCategory UsUkPassportNumber { get; } = new PiiCategory(UsUkPassportNumberValue); + /// US Bank Account Number. + public static PiiCategory UsBankAccountNumber { get; } = new PiiCategory(UsBankAccountNumberValue); + /// US Driver's License Number. + public static PiiCategory UsDriversLicenseNumber { get; } = new PiiCategory(UsDriversLicenseNumberValue); + /// US Individual Taxpayer Identification. + public static PiiCategory UsIndividualTaxpayerIdentification { get; } = new PiiCategory(UsIndividualTaxpayerIdentificationValue); + /// US Social Security Number. + public static PiiCategory UsSocialSecurityNumber { get; } = new PiiCategory(UsSocialSecurityNumberValue); + /// UA Passport Number Domestic. + public static PiiCategory UaPassportNumberDomestic { get; } = new PiiCategory(UaPassportNumberDomesticValue); + /// UA Passport Number International. + public static PiiCategory UaPassportNumberInternational { get; } = new PiiCategory(UaPassportNumberInternationalValue); + /// Organization. + public static PiiCategory Organization { get; } = new PiiCategory(OrganizationValue); + /// Email. + public static PiiCategory Email { get; } = new PiiCategory(EmailValue); + /// URL. + public static PiiCategory URL { get; } = new PiiCategory(URLValue); + /// Age. + public static PiiCategory Age { get; } = new PiiCategory(AgeValue); + /// Phone Number. + public static PiiCategory PhoneNumber { get; } = new PiiCategory(PhoneNumberValue); + /// IP Address. + public static PiiCategory IPAddress { get; } = new PiiCategory(IPAddressValue); + /// Date. + public static PiiCategory Date { get; } = new PiiCategory(DateValue); + /// Person. + public static PiiCategory Person { get; } = new PiiCategory(PersonValue); + /// Address. + public static PiiCategory Address { get; } = new PiiCategory(AddressValue); + /// All PII categories. + public static PiiCategory All { get; } = new PiiCategory(AllValue); + /// Default PII categories for the language. + public static PiiCategory Default { get; } = new PiiCategory(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(PiiCategory left, PiiCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PiiCategory left, PiiCategory right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PiiCategory(string value) => new PiiCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PiiCategory other && Equals(other); + /// + public bool Equals(PiiCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiDomain.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiDomain.cs new file mode 100644 index 000000000000..95392ccb21b5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiDomain.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// PII domains. + public readonly partial struct PiiDomain : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PiiDomain(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PhiValue = "phi"; + private const string NoneValue = "none"; + + /// Indicates that entities in the Personal Health Information domain should be redacted. + public static PiiDomain Phi { get; } = new PiiDomain(PhiValue); + /// Indicates that no domain is specified. + public static PiiDomain None { get; } = new PiiDomain(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(PiiDomain left, PiiDomain right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PiiDomain left, PiiDomain right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PiiDomain(string value) => new PiiDomain(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PiiDomain other && Equals(other); + /// + public bool Equals(PiiDomain other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiEntityRecognitionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiEntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 000000000000..e1375ba833d3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiEntityRecognitionOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class PiiEntityRecognitionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + PiiEntityRecognitionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiEntityRecognitionOperationResult(document.RootElement, options); + } + + internal static PiiEntityRecognitionOperationResult DeserializePiiEntityRecognitionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = PiiResult.DeserializePiiResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + PiiEntityRecognitionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiEntityRecognitionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PiiEntityRecognitionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiEntityRecognitionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiEntityRecognitionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiEntityRecognitionOperationResult.cs new file mode 100644 index 000000000000..70cbe83734d7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiEntityRecognitionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the PII LRO results. + public partial class PiiEntityRecognitionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// The list of pii results. + /// is null. + internal PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, PiiResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.PiiEntityRecognitionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// The list of pii results. + internal PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, PiiResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal PiiEntityRecognitionOperationResult() + { + } + + /// The list of pii results. + public PiiResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiOperationAction.Serialization.cs new file mode 100644 index 000000000000..727f1d875349 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class PiiOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + PiiOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiOperationAction(document.RootElement, options); + } + + internal static PiiOperationAction DeserializePiiOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = PiiActionContent.DeserializePiiActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support writing '{options.Format}' format."); + } + } + + PiiOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PiiOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiOperationAction.cs new file mode 100644 index 000000000000..4b6dfe2bcaba --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text PIIEntityRecognition LRO task. + public partial class PiiOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public PiiOperationAction() + { + Kind = AnalyzeTextOperationActionKind.PiiEntityRecognition; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Pii task parameters. + internal PiiOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, PiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Pii task parameters. + public PiiActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiResult.Serialization.cs new file mode 100644 index 000000000000..2d22724f3355 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class PiiResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PiiResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiResult(document.RootElement, options); + } + + internal static PiiResult DeserializePiiResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PiiActionResult.DeserializePiiActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiResult)} does not support writing '{options.Format}' format."); + } + } + + PiiResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PiiResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiResult.cs new file mode 100644 index 000000000000..a24e2e26d1ca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PiiResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Contains the PiiResult. + public partial class PiiResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal PiiResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal PiiResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PiiResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PolicyKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PolicyKind.cs new file mode 100644 index 000000000000..b1435e5e5f9e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PolicyKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Kinds of overlap policies supported. + internal readonly partial struct PolicyKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MatchLongestValue = "matchLongest"; + private const string AllowOverlapValue = "allowOverlap"; + + /// Represents MatchLongestEntityPolicyType. + public static PolicyKind MatchLongest { get; } = new PolicyKind(MatchLongestValue); + /// Represents AllowOverlapEntityPolicyType. + public static PolicyKind AllowOverlap { get; } = new PolicyKind(AllowOverlapValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyKind left, PolicyKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyKind left, PolicyKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PolicyKind(string value) => new PolicyKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyKind other && Equals(other); + /// + public bool Equals(PolicyKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PrebuiltComponent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PrebuiltComponent.Serialization.cs new file mode 100644 index 000000000000..cdc53f548a18 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PrebuiltComponent.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class PrebuiltComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + } + + PrebuiltComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrebuiltComponent(document.RootElement, options); + } + + internal static PrebuiltComponent DeserializePrebuiltComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + EntityComponentKind entityComponentKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PrebuiltComponent(entityComponentKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support writing '{options.Format}' format."); + } + } + + PrebuiltComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePrebuiltComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PrebuiltComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePrebuiltComponent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PrebuiltComponent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PrebuiltComponent.cs new file mode 100644 index 000000000000..0e8e9abf1f38 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/PrebuiltComponent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// This object contains information of the prebuilt component of the detected entity. + public partial class PrebuiltComponent : EntityComponentInformation + { + /// Initializes a new instance of . + internal PrebuiltComponent() + { + EntityComponentKind = EntityComponentKind.PrebuiltComponent; + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + /// The prebuilt component of an extracted entity type. + internal PrebuiltComponent(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData, string value) : base(entityComponentKind, serializedAdditionalRawData) + { + Value = value; + } + + /// The prebuilt component of an extracted entity type. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RangeInclusivity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RangeInclusivity.cs new file mode 100644 index 000000000000..c745f89e792f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RangeInclusivity.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The range inclusiveness of this property property. + public readonly partial struct RangeInclusivity : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RangeInclusivity(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneInclusiveValue = "NoneInclusive"; + private const string LeftInclusiveValue = "LeftInclusive"; + private const string RightInclusiveValue = "RightInclusive"; + private const string LeftRightInclusiveValue = "LeftRightInclusive"; + + /// No inclusivity. + public static RangeInclusivity NoneInclusive { get; } = new RangeInclusivity(NoneInclusiveValue); + /// Left side inclusive. + public static RangeInclusivity LeftInclusive { get; } = new RangeInclusivity(LeftInclusiveValue); + /// Right side inclusive. + public static RangeInclusivity RightInclusive { get; } = new RangeInclusivity(RightInclusiveValue); + /// Both sides inclusive. + public static RangeInclusivity LeftRightInclusive { get; } = new RangeInclusivity(LeftRightInclusiveValue); + /// Determines if two values are the same. + public static bool operator ==(RangeInclusivity left, RangeInclusivity right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RangeInclusivity left, RangeInclusivity right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RangeInclusivity(string value) => new RangeInclusivity(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RangeInclusivity other && Equals(other); + /// + public bool Equals(RangeInclusivity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RangeKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RangeKind.cs new file mode 100644 index 000000000000..433355f0c1ef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RangeKind.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The kind of the number range entity. + public readonly partial struct RangeKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RangeKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NumberValue = "Number"; + private const string SpeedValue = "Speed"; + private const string WeightValue = "Weight"; + private const string LengthValue = "Length"; + private const string VolumeValue = "Volume"; + private const string AreaValue = "Area"; + private const string AgeValue = "Age"; + private const string InformationValue = "Information"; + private const string TemperatureValue = "Temperature"; + private const string CurrencyValue = "Currency"; + + /// Number range. + public static RangeKind Number { get; } = new RangeKind(NumberValue); + /// Speed range. + public static RangeKind Speed { get; } = new RangeKind(SpeedValue); + /// Weight range. + public static RangeKind Weight { get; } = new RangeKind(WeightValue); + /// Length range. + public static RangeKind Length { get; } = new RangeKind(LengthValue); + /// Volume range. + public static RangeKind Volume { get; } = new RangeKind(VolumeValue); + /// Area range. + public static RangeKind Area { get; } = new RangeKind(AreaValue); + /// Age range. + public static RangeKind Age { get; } = new RangeKind(AgeValue); + /// Information range. + public static RangeKind Information { get; } = new RangeKind(InformationValue); + /// Temperature range. + public static RangeKind Temperature { get; } = new RangeKind(TemperatureValue); + /// Currency range. + public static RangeKind Currency { get; } = new RangeKind(CurrencyValue); + /// Determines if two values are the same. + public static bool operator ==(RangeKind left, RangeKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RangeKind left, RangeKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RangeKind(string value) => new RangeKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RangeKind other && Equals(other); + /// + public bool Equals(RangeKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RedactionCharacter.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RedactionCharacter.cs new file mode 100644 index 000000000000..746eb7f43bc8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RedactionCharacter.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Optional parameter to use a Custom Character to be used for redaction in PII responses. Default character will be * as before. We allow specific ascii characters for redaction. + public readonly partial struct RedactionCharacter : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedactionCharacter(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ExclamationPointValue = "!"; + private const string NumberSignValue = "#"; + private const string DollarValue = "$"; + private const string PerCentValue = "%"; + private const string AmpersandValue = "&"; + private const string AsteriskValue = "*"; + private const string PlusValue = "+"; + private const string MinusValue = "-"; + private const string EqualsValueValue = "="; + private const string QuestionMarkValue = "?"; + private const string AtSignValue = "@"; + private const string CaretValue = "^"; + private const string UnderscoreValue = "_"; + private const string TildeValue = "~"; + + /// Exclamation point character. + public static RedactionCharacter ExclamationPoint { get; } = new RedactionCharacter(ExclamationPointValue); + /// Number sign character. + public static RedactionCharacter NumberSign { get; } = new RedactionCharacter(NumberSignValue); + /// Dollar sign character. + public static RedactionCharacter Dollar { get; } = new RedactionCharacter(DollarValue); + /// Percent sign character. + public static RedactionCharacter PerCent { get; } = new RedactionCharacter(PerCentValue); + /// Ampersand character. + public static RedactionCharacter Ampersand { get; } = new RedactionCharacter(AmpersandValue); + /// Asterisk character. + public static RedactionCharacter Asterisk { get; } = new RedactionCharacter(AsteriskValue); + /// Plus sign character. + public static RedactionCharacter Plus { get; } = new RedactionCharacter(PlusValue); + /// Minus sign character. + public static RedactionCharacter Minus { get; } = new RedactionCharacter(MinusValue); + /// Equals sign character. + public static RedactionCharacter EqualsValue { get; } = new RedactionCharacter(EqualsValueValue); + /// Question mark character. + public static RedactionCharacter QuestionMark { get; } = new RedactionCharacter(QuestionMarkValue); + /// At sign character. + public static RedactionCharacter AtSign { get; } = new RedactionCharacter(AtSignValue); + /// Caret character. + public static RedactionCharacter Caret { get; } = new RedactionCharacter(CaretValue); + /// Underscore character. + public static RedactionCharacter Underscore { get; } = new RedactionCharacter(UnderscoreValue); + /// Tilde character. + public static RedactionCharacter Tilde { get; } = new RedactionCharacter(TildeValue); + /// Determines if two values are the same. + public static bool operator ==(RedactionCharacter left, RedactionCharacter right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedactionCharacter left, RedactionCharacter right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedactionCharacter(string value) => new RedactionCharacter(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedactionCharacter other && Equals(other); + /// + public bool Equals(RedactionCharacter other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RelationType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RelationType.cs new file mode 100644 index 000000000000..4ccdfa3858b7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RelationType.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + public readonly partial struct RelationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RelationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AbbreviationValue = "Abbreviation"; + private const string DirectionOfBodyStructureValue = "DirectionOfBodyStructure"; + private const string DirectionOfConditionValue = "DirectionOfCondition"; + private const string DirectionOfExaminationValue = "DirectionOfExamination"; + private const string DirectionOfTreatmentValue = "DirectionOfTreatment"; + private const string DosageOfMedicationValue = "DosageOfMedication"; + private const string FormOfMedicationValue = "FormOfMedication"; + private const string FrequencyOfMedicationValue = "FrequencyOfMedication"; + private const string FrequencyOfTreatmentValue = "FrequencyOfTreatment"; + private const string QualifierOfConditionValue = "QualifierOfCondition"; + private const string RelationOfExaminationValue = "RelationOfExamination"; + private const string RouteOfMedicationValue = "RouteOfMedication"; + private const string TimeOfConditionValue = "TimeOfCondition"; + private const string TimeOfEventValue = "TimeOfEvent"; + private const string TimeOfExaminationValue = "TimeOfExamination"; + private const string TimeOfMedicationValue = "TimeOfMedication"; + private const string TimeOfTreatmentValue = "TimeOfTreatment"; + private const string UnitOfConditionValue = "UnitOfCondition"; + private const string UnitOfExaminationValue = "UnitOfExamination"; + private const string ValueOfConditionValue = "ValueOfCondition"; + private const string ValueOfExaminationValue = "ValueOfExamination"; + private const string BodySiteOfConditionValue = "BodySiteOfCondition"; + private const string BodySiteOfTreatmentValue = "BodySiteOfTreatment"; + private const string CourseOfConditionValue = "CourseOfCondition"; + private const string CourseOfExaminationValue = "CourseOfExamination"; + private const string CourseOfMedicationValue = "CourseOfMedication"; + private const string CourseOfTreatmentValue = "CourseOfTreatment"; + private const string ExaminationFindsConditionValue = "ExaminationFindsCondition"; + private const string ExpressionOfGeneValue = "ExpressionOfGene"; + private const string ExpressionOfVariantValue = "ExpressionOfVariant"; + private const string FrequencyOfConditionValue = "FrequencyOfCondition"; + private const string MutationTypeOfGeneValue = "MutationTypeOfGene"; + private const string MutationTypeOfVariantValue = "MutationTypeOfVariant"; + private const string ScaleOfConditionValue = "ScaleOfCondition"; + private const string VariantOfGeneValue = "VariantOfGene"; + + /// Abbreviation. + public static RelationType Abbreviation { get; } = new RelationType(AbbreviationValue); + /// Direction of body structure. + public static RelationType DirectionOfBodyStructure { get; } = new RelationType(DirectionOfBodyStructureValue); + /// Direction of condition. + public static RelationType DirectionOfCondition { get; } = new RelationType(DirectionOfConditionValue); + /// Direction of examination. + public static RelationType DirectionOfExamination { get; } = new RelationType(DirectionOfExaminationValue); + /// Direction of treatment. + public static RelationType DirectionOfTreatment { get; } = new RelationType(DirectionOfTreatmentValue); + /// Dosage of medication. + public static RelationType DosageOfMedication { get; } = new RelationType(DosageOfMedicationValue); + /// Form of medication. + public static RelationType FormOfMedication { get; } = new RelationType(FormOfMedicationValue); + /// Frequency of medication. + public static RelationType FrequencyOfMedication { get; } = new RelationType(FrequencyOfMedicationValue); + /// Frequency of treatment. + public static RelationType FrequencyOfTreatment { get; } = new RelationType(FrequencyOfTreatmentValue); + /// Qualifier of condition. + public static RelationType QualifierOfCondition { get; } = new RelationType(QualifierOfConditionValue); + /// Relation of examination. + public static RelationType RelationOfExamination { get; } = new RelationType(RelationOfExaminationValue); + /// Route of medication. + public static RelationType RouteOfMedication { get; } = new RelationType(RouteOfMedicationValue); + /// Time of condition. + public static RelationType TimeOfCondition { get; } = new RelationType(TimeOfConditionValue); + /// Time of event. + public static RelationType TimeOfEvent { get; } = new RelationType(TimeOfEventValue); + /// Time of examination. + public static RelationType TimeOfExamination { get; } = new RelationType(TimeOfExaminationValue); + /// Time of medication. + public static RelationType TimeOfMedication { get; } = new RelationType(TimeOfMedicationValue); + /// Time of treatment. + public static RelationType TimeOfTreatment { get; } = new RelationType(TimeOfTreatmentValue); + /// Unit of condition. + public static RelationType UnitOfCondition { get; } = new RelationType(UnitOfConditionValue); + /// Unit of examination. + public static RelationType UnitOfExamination { get; } = new RelationType(UnitOfExaminationValue); + /// Value of condition. + public static RelationType ValueOfCondition { get; } = new RelationType(ValueOfConditionValue); + /// Value of examination. + public static RelationType ValueOfExamination { get; } = new RelationType(ValueOfExaminationValue); + /// Body site of condition. + public static RelationType BodySiteOfCondition { get; } = new RelationType(BodySiteOfConditionValue); + /// Body site of treatment. + public static RelationType BodySiteOfTreatment { get; } = new RelationType(BodySiteOfTreatmentValue); + /// Course of condition. + public static RelationType CourseOfCondition { get; } = new RelationType(CourseOfConditionValue); + /// Course of examination. + public static RelationType CourseOfExamination { get; } = new RelationType(CourseOfExaminationValue); + /// Course of medication. + public static RelationType CourseOfMedication { get; } = new RelationType(CourseOfMedicationValue); + /// Course of treatment. + public static RelationType CourseOfTreatment { get; } = new RelationType(CourseOfTreatmentValue); + /// Examination finds condition. + public static RelationType ExaminationFindsCondition { get; } = new RelationType(ExaminationFindsConditionValue); + /// Expression of gene. + public static RelationType ExpressionOfGene { get; } = new RelationType(ExpressionOfGeneValue); + /// Expression of variant. + public static RelationType ExpressionOfVariant { get; } = new RelationType(ExpressionOfVariantValue); + /// Frequency of condition. + public static RelationType FrequencyOfCondition { get; } = new RelationType(FrequencyOfConditionValue); + /// Mutation type of gene. + public static RelationType MutationTypeOfGene { get; } = new RelationType(MutationTypeOfGeneValue); + /// Mutation type of variant. + public static RelationType MutationTypeOfVariant { get; } = new RelationType(MutationTypeOfVariantValue); + /// Scale of condition. + public static RelationType ScaleOfCondition { get; } = new RelationType(ScaleOfConditionValue); + /// Variant of gene. + public static RelationType VariantOfGene { get; } = new RelationType(VariantOfGeneValue); + /// Determines if two values are the same. + public static bool operator ==(RelationType left, RelationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RelationType left, RelationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RelationType(string value) => new RelationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RelationType other && Equals(other); + /// + public bool Equals(RelationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RelativeTo.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RelativeTo.cs new file mode 100644 index 000000000000..5cddbbdd4905 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RelativeTo.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The reference point that the ordinal number denotes. + public readonly partial struct RelativeTo : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RelativeTo(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CurrentValue = "Current"; + private const string EndValue = "End"; + private const string StartValue = "Start"; + + /// Current state or position. + public static RelativeTo Current { get; } = new RelativeTo(CurrentValue); + /// End state or position. + public static RelativeTo End { get; } = new RelativeTo(EndValue); + /// Start state or position. + public static RelativeTo Start { get; } = new RelativeTo(StartValue); + /// Determines if two values are the same. + public static bool operator ==(RelativeTo left, RelativeTo right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RelativeTo left, RelativeTo right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RelativeTo(string value) => new RelativeTo(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RelativeTo other && Equals(other); + /// + public bool Equals(RelativeTo other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RequestStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RequestStatistics.Serialization.cs new file mode 100644 index 000000000000..d0d5f69cad34 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RequestStatistics.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class RequestStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestStatistics)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("documentsCount"u8); + writer.WriteNumberValue(DocumentsCount); + writer.WritePropertyName("validDocumentsCount"u8); + writer.WriteNumberValue(ValidDocumentsCount); + writer.WritePropertyName("erroneousDocumentsCount"u8); + writer.WriteNumberValue(ErroneousDocumentsCount); + writer.WritePropertyName("transactionsCount"u8); + writer.WriteNumberValue(TransactionsCount); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RequestStatistics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequestStatistics(document.RootElement, options); + } + + internal static RequestStatistics DeserializeRequestStatistics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int documentsCount = default; + int validDocumentsCount = default; + int erroneousDocumentsCount = default; + long transactionsCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documentsCount"u8)) + { + documentsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("validDocumentsCount"u8)) + { + validDocumentsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("erroneousDocumentsCount"u8)) + { + erroneousDocumentsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("transactionsCount"u8)) + { + transactionsCount = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequestStatistics(documentsCount, validDocumentsCount, erroneousDocumentsCount, transactionsCount, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequestStatistics)} does not support writing '{options.Format}' format."); + } + } + + RequestStatistics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequestStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequestStatistics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RequestStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRequestStatistics(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RequestStatistics.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RequestStatistics.cs new file mode 100644 index 000000000000..4251151be037 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/RequestStatistics.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// if showStats=true was specified in the request this field will contain information about the request payload. + public partial class RequestStatistics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of documents submitted in the request. + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + /// Number of transactions for the request. + internal RequestStatistics(int documentsCount, int validDocumentsCount, int erroneousDocumentsCount, long transactionsCount) + { + DocumentsCount = documentsCount; + ValidDocumentsCount = validDocumentsCount; + ErroneousDocumentsCount = erroneousDocumentsCount; + TransactionsCount = transactionsCount; + } + + /// Initializes a new instance of . + /// Number of documents submitted in the request. + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + /// Number of transactions for the request. + /// Keeps track of any properties unknown to the library. + internal RequestStatistics(int documentsCount, int validDocumentsCount, int erroneousDocumentsCount, long transactionsCount, IDictionary serializedAdditionalRawData) + { + DocumentsCount = documentsCount; + ValidDocumentsCount = validDocumentsCount; + ErroneousDocumentsCount = erroneousDocumentsCount; + TransactionsCount = transactionsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestStatistics() + { + } + + /// Number of documents submitted in the request. + public int DocumentsCount { get; } + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + public int ValidDocumentsCount { get; } + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + public int ErroneousDocumentsCount { get; } + /// Number of transactions for the request. + public long TransactionsCount { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ScriptCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ScriptCode.cs new file mode 100644 index 000000000000..7e60f50f2d88 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ScriptCode.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Identifies the script of the input document. Maps to the ISO 15924 standard script code. + public readonly partial struct ScriptCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ArabValue = "Arab"; + private const string ArmnValue = "Armn"; + private const string BengValue = "Beng"; + private const string CansValue = "Cans"; + private const string CyrlValue = "Cyrl"; + private const string DevaValue = "Deva"; + private const string EthiValue = "Ethi"; + private const string GeorValue = "Geor"; + private const string GrekValue = "Grek"; + private const string GujrValue = "Gujr"; + private const string GuruValue = "Guru"; + private const string HangValue = "Hang"; + private const string HansValue = "Hans"; + private const string HantValue = "Hant"; + private const string HebrValue = "Hebr"; + private const string JpanValue = "Jpan"; + private const string KhmrValue = "Khmr"; + private const string KndaValue = "Knda"; + private const string LaooValue = "Laoo"; + private const string LatnValue = "Latn"; + private const string MlymValue = "Mlym"; + private const string MymrValue = "Mymr"; + private const string OryaValue = "Orya"; + private const string SinhValue = "Sinh"; + private const string TamlValue = "Taml"; + private const string TeluValue = "Telu"; + private const string ThaaValue = "Thaa"; + private const string ThaiValue = "Thai"; + private const string TibtValue = "Tibt"; + + /// Script code for the Arabic script. + public static ScriptCode Arab { get; } = new ScriptCode(ArabValue); + /// Script code for the Armenian script. + public static ScriptCode Armn { get; } = new ScriptCode(ArmnValue); + /// Script code for the Bangla script. + public static ScriptCode Beng { get; } = new ScriptCode(BengValue); + /// Script code for the UnifiedCanadianAboriginalSyllabics script. + public static ScriptCode Cans { get; } = new ScriptCode(CansValue); + /// Script code for the Cyrillic script. + public static ScriptCode Cyrl { get; } = new ScriptCode(CyrlValue); + /// Script code for the Devanagari script. + public static ScriptCode Deva { get; } = new ScriptCode(DevaValue); + /// Script code for the Ethiopic script. + public static ScriptCode Ethi { get; } = new ScriptCode(EthiValue); + /// Script code for the Georgian script. + public static ScriptCode Geor { get; } = new ScriptCode(GeorValue); + /// Script code for the Greek script. + public static ScriptCode Grek { get; } = new ScriptCode(GrekValue); + /// Script code for the Gujarati script. + public static ScriptCode Gujr { get; } = new ScriptCode(GujrValue); + /// Script code for the Gurmukhi script. + public static ScriptCode Guru { get; } = new ScriptCode(GuruValue); + /// Script code for the Hangul script. + public static ScriptCode Hang { get; } = new ScriptCode(HangValue); + /// Script code for the HanSimplified script. + public static ScriptCode Hans { get; } = new ScriptCode(HansValue); + /// Script code for the HanTraditional script. + public static ScriptCode Hant { get; } = new ScriptCode(HantValue); + /// Script code for the Hebrew script. + public static ScriptCode Hebr { get; } = new ScriptCode(HebrValue); + /// Script code for the Japanese script. + public static ScriptCode Jpan { get; } = new ScriptCode(JpanValue); + /// Script code for the Khmer script. + public static ScriptCode Khmr { get; } = new ScriptCode(KhmrValue); + /// Script code for the Kannada script. + public static ScriptCode Knda { get; } = new ScriptCode(KndaValue); + /// Script code for the Lao script. + public static ScriptCode Laoo { get; } = new ScriptCode(LaooValue); + /// Script code for the Latin script. + public static ScriptCode Latn { get; } = new ScriptCode(LatnValue); + /// Script code for the Malayalam script. + public static ScriptCode Mlym { get; } = new ScriptCode(MlymValue); + /// Script code for the Myanmar script. + public static ScriptCode Mymr { get; } = new ScriptCode(MymrValue); + /// Script code for the Odia script. + public static ScriptCode Orya { get; } = new ScriptCode(OryaValue); + /// Script code for the Sinhala script. + public static ScriptCode Sinh { get; } = new ScriptCode(SinhValue); + /// Script code for the Tamil script. + public static ScriptCode Taml { get; } = new ScriptCode(TamlValue); + /// Script code for the Telugu script. + public static ScriptCode Telu { get; } = new ScriptCode(TeluValue); + /// Script code for the Thaana script. + public static ScriptCode Thaa { get; } = new ScriptCode(ThaaValue); + /// Script code for the Thai script. + public static ScriptCode Thai { get; } = new ScriptCode(ThaiValue); + /// Script code for the Tibetan script. + public static ScriptCode Tibt { get; } = new ScriptCode(TibtValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptCode left, ScriptCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptCode left, ScriptCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ScriptCode(string value) => new ScriptCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptCode other && Equals(other); + /// + public bool Equals(ScriptCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ScriptKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ScriptKind.cs new file mode 100644 index 000000000000..75e88027f757 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/ScriptKind.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Identifies the script of the input document. Maps to the ISO 15924 standard formal name. + public readonly partial struct ScriptKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ArabicValue = "Arabic"; + private const string ArmenianValue = "Armenian"; + private const string BanglaValue = "Bangla"; + private const string UnifiedCanadianAboriginalSyllabicsValue = "UnifiedCanadianAboriginalSyllabics"; + private const string CyrillicValue = "Cyrillic"; + private const string DevanagariValue = "Devanagari"; + private const string EthiopicValue = "Ethiopic"; + private const string GeorgianValue = "Georgian"; + private const string GreekValue = "Greek"; + private const string GujaratiValue = "Gujarati"; + private const string GurmukhiValue = "Gurmukhi"; + private const string HangulValue = "Hangul"; + private const string HanSimplifiedValue = "HanSimplified"; + private const string HanTraditionalValue = "HanTraditional"; + private const string HebrewValue = "Hebrew"; + private const string JapaneseValue = "Japanese"; + private const string KhmerValue = "Khmer"; + private const string KannadaValue = "Kannada"; + private const string LaoValue = "Lao"; + private const string LatinValue = "Latin"; + private const string MalayalamValue = "Malayalam"; + private const string MyanmarValue = "Myanmar"; + private const string OdiaValue = "Odia"; + private const string SinhalaValue = "Sinhala"; + private const string TamilValue = "Tamil"; + private const string TeluguValue = "Telugu"; + private const string ThaanaValue = "Thaana"; + private const string ThaiValue = "Thai"; + private const string TibetanValue = "Tibetan"; + + /// Script name for the Arabic script. + public static ScriptKind Arabic { get; } = new ScriptKind(ArabicValue); + /// Script name for the Armenian script. + public static ScriptKind Armenian { get; } = new ScriptKind(ArmenianValue); + /// Script name for the Bangla script. + public static ScriptKind Bangla { get; } = new ScriptKind(BanglaValue); + /// Script name for the UnifiedCanadianAboriginalSyllabics script. + public static ScriptKind UnifiedCanadianAboriginalSyllabics { get; } = new ScriptKind(UnifiedCanadianAboriginalSyllabicsValue); + /// Script name for the Cyrillic script. + public static ScriptKind Cyrillic { get; } = new ScriptKind(CyrillicValue); + /// Script name for the Devanagari script. + public static ScriptKind Devanagari { get; } = new ScriptKind(DevanagariValue); + /// Script name for the Ethiopic script. + public static ScriptKind Ethiopic { get; } = new ScriptKind(EthiopicValue); + /// Script name for the Georgian script. + public static ScriptKind Georgian { get; } = new ScriptKind(GeorgianValue); + /// Script name for the Greek script. + public static ScriptKind Greek { get; } = new ScriptKind(GreekValue); + /// Script name for the Gujarati script. + public static ScriptKind Gujarati { get; } = new ScriptKind(GujaratiValue); + /// Script name for the Gurmukhi script. + public static ScriptKind Gurmukhi { get; } = new ScriptKind(GurmukhiValue); + /// Script name for the Hangul script. + public static ScriptKind Hangul { get; } = new ScriptKind(HangulValue); + /// Script name for the HanSimplified script. + public static ScriptKind HanSimplified { get; } = new ScriptKind(HanSimplifiedValue); + /// Script name for the HanTraditional script. + public static ScriptKind HanTraditional { get; } = new ScriptKind(HanTraditionalValue); + /// Script name for the Hebrew script. + public static ScriptKind Hebrew { get; } = new ScriptKind(HebrewValue); + /// Script name for the Japanese script. + public static ScriptKind Japanese { get; } = new ScriptKind(JapaneseValue); + /// Script name for the Khmer script. + public static ScriptKind Khmer { get; } = new ScriptKind(KhmerValue); + /// Script name for the Kannada script. + public static ScriptKind Kannada { get; } = new ScriptKind(KannadaValue); + /// Script name for the Lao script. + public static ScriptKind Lao { get; } = new ScriptKind(LaoValue); + /// Script name for the Latin script. + public static ScriptKind Latin { get; } = new ScriptKind(LatinValue); + /// Script name for the Malayalam script. + public static ScriptKind Malayalam { get; } = new ScriptKind(MalayalamValue); + /// Script name for the Myanmar script. + public static ScriptKind Myanmar { get; } = new ScriptKind(MyanmarValue); + /// Script name for the Odia script. + public static ScriptKind Odia { get; } = new ScriptKind(OdiaValue); + /// Script name for the Sinhala script. + public static ScriptKind Sinhala { get; } = new ScriptKind(SinhalaValue); + /// Script name for the Tamil script. + public static ScriptKind Tamil { get; } = new ScriptKind(TamilValue); + /// Script name for the Telugu script. + public static ScriptKind Telugu { get; } = new ScriptKind(TeluguValue); + /// Script name for the Thaana script. + public static ScriptKind Thaana { get; } = new ScriptKind(ThaanaValue); + /// Script name for the Thai script. + public static ScriptKind Thai { get; } = new ScriptKind(ThaiValue); + /// Script name for the Tibetan script. + public static ScriptKind Tibetan { get; } = new ScriptKind(TibetanValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptKind left, ScriptKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptKind left, ScriptKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ScriptKind(string value) => new ScriptKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptKind other && Equals(other); + /// + public bool Equals(ScriptKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceAssessment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceAssessment.Serialization.cs new file mode 100644 index 000000000000..5c9b046cdb66 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceAssessment.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentenceAssessment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("isNegated"u8); + writer.WriteBooleanValue(IsNegated); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentenceAssessment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentenceAssessment(document.RootElement, options); + } + + internal static SentenceAssessment DeserializeSentenceAssessment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TokenSentiment sentiment = default; + TargetConfidenceScoreLabel confidenceScores = default; + int offset = default; + int length = default; + string text = default; + bool isNegated = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToTokenSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = TargetConfidenceScoreLabel.DeserializeTargetConfidenceScoreLabel(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("isNegated"u8)) + { + isNegated = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentenceAssessment( + sentiment, + confidenceScores, + offset, + length, + text, + isNegated, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support writing '{options.Format}' format."); + } + } + + SentenceAssessment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentenceAssessment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentenceAssessment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentenceAssessment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceAssessment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceAssessment.cs new file mode 100644 index 000000000000..c0de8286c4ac --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceAssessment.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents a sentence assessment and the assessments or target objects related to it. + public partial class SentenceAssessment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The indicator representing if the assessment is negated. + /// or is null. + internal SentenceAssessment(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, bool isNegated) + { + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(text, nameof(text)); + + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + IsNegated = isNegated; + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The indicator representing if the assessment is negated. + /// Keeps track of any properties unknown to the library. + internal SentenceAssessment(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, bool isNegated, IDictionary serializedAdditionalRawData) + { + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + IsNegated = isNegated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentenceAssessment() + { + } + + /// The sentiment of the sentence. + public TokenSentiment Sentiment { get; } + /// Represents the confidence scores across all sentiment classes: positive and negative. + public TargetConfidenceScoreLabel ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + /// The target text detected. + public string Text { get; } + /// The indicator representing if the assessment is negated. + public bool IsNegated { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentiment.Serialization.cs new file mode 100644 index 000000000000..f95b59ffbc56 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentiment.Serialization.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentenceSentiment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (Optional.IsCollectionDefined(Targets)) + { + writer.WritePropertyName("targets"u8); + writer.WriteStartArray(); + foreach (var item in Targets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Assessments)) + { + writer.WritePropertyName("assessments"u8); + writer.WriteStartArray(); + foreach (var item in Assessments) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentenceSentiment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentenceSentiment(document.RootElement, options); + } + + internal static SentenceSentiment DeserializeSentenceSentiment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + SentenceSentimentValue sentiment = default; + SentimentConfidenceScores confidenceScores = default; + int offset = default; + int length = default; + IReadOnlyList targets = default; + IReadOnlyList assessments = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToSentenceSentimentValue(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("targets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceTarget.DeserializeSentenceTarget(item, options)); + } + targets = array; + continue; + } + if (property.NameEquals("assessments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceAssessment.DeserializeSentenceAssessment(item, options)); + } + assessments = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + targets ?? new ChangeTrackingList(), + assessments ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support writing '{options.Format}' format."); + } + } + + SentenceSentiment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentenceSentiment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentenceSentiment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentenceSentiment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentiment.cs new file mode 100644 index 000000000000..d0c9c2f2adfb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentiment.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A document's sentence sentiment. + public partial class SentenceSentiment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// or is null. + internal SentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Targets = new ChangeTrackingList(); + Assessments = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The array of sentence targets for the sentence. + /// The array of assessments for the sentence. + /// Keeps track of any properties unknown to the library. + internal SentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IReadOnlyList targets, IReadOnlyList assessments, IDictionary serializedAdditionalRawData) + { + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Targets = targets; + Assessments = assessments; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentenceSentiment() + { + } + + /// The sentence text. + public string Text { get; } + /// The predicted Sentiment for the sentence. + public SentenceSentimentValue Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + /// The array of sentence targets for the sentence. + public IReadOnlyList Targets { get; } + /// The array of assessments for the sentence. + public IReadOnlyList Assessments { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentimentValue.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentimentValue.Serialization.cs new file mode 100644 index 000000000000..41df3c8356df --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentimentValue.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class SentenceSentimentValueExtensions + { + public static string ToSerialString(this SentenceSentimentValue value) => value switch + { + SentenceSentimentValue.Positive => "positive", + SentenceSentimentValue.Neutral => "neutral", + SentenceSentimentValue.Negative => "negative", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SentenceSentimentValue value.") + }; + + public static SentenceSentimentValue ToSentenceSentimentValue(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return SentenceSentimentValue.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "neutral")) return SentenceSentimentValue.Neutral; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return SentenceSentimentValue.Negative; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SentenceSentimentValue value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentimentValue.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentimentValue.cs new file mode 100644 index 000000000000..58309971e1e2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceSentimentValue.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// The predicted Sentiment for the sentence. + public enum SentenceSentimentValue + { + /// Positive sentiment. + Positive, + /// Neutral sentiment. + Neutral, + /// Negative sentiment. + Negative + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceTarget.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceTarget.Serialization.cs new file mode 100644 index 000000000000..88fce14e9035 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceTarget.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentenceTarget : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceTarget)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("relations"u8); + writer.WriteStartArray(); + foreach (var item in Relations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentenceTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceTarget)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentenceTarget(document.RootElement, options); + } + + internal static SentenceTarget DeserializeSentenceTarget(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TokenSentiment sentiment = default; + TargetConfidenceScoreLabel confidenceScores = default; + int offset = default; + int length = default; + string text = default; + IReadOnlyList relations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToTokenSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = TargetConfidenceScoreLabel.DeserializeTargetConfidenceScoreLabel(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TargetRelation.DeserializeTargetRelation(item, options)); + } + relations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentenceTarget( + sentiment, + confidenceScores, + offset, + length, + text, + relations, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentenceTarget)} does not support writing '{options.Format}' format."); + } + } + + SentenceTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentenceTarget(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentenceTarget)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentenceTarget FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentenceTarget(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceTarget.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceTarget.cs new file mode 100644 index 000000000000..53f4e9a84ec6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentenceTarget.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Represents a sentence target and the assessments or target objects related to it. + public partial class SentenceTarget + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The array of either assessment or target objects which is related to the target. + /// , or is null. + internal SentenceTarget(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IEnumerable relations) + { + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(relations, nameof(relations)); + + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + Relations = relations.ToList(); + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The array of either assessment or target objects which is related to the target. + /// Keeps track of any properties unknown to the library. + internal SentenceTarget(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IReadOnlyList relations, IDictionary serializedAdditionalRawData) + { + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + Relations = relations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentenceTarget() + { + } + + /// The sentiment of the sentence. + public TokenSentiment Sentiment { get; } + /// Represents the confidence scores across all sentiment classes: positive and negative. + public TargetConfidenceScoreLabel ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + /// The target text detected. + public string Text { get; } + /// The array of either assessment or target objects which is related to the target. + public IReadOnlyList Relations { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentActionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentActionResult.Serialization.cs new file mode 100644 index 000000000000..cfa7db1d0d61 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentActionResult.Serialization.cs @@ -0,0 +1,232 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentimentActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentActionResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("sentences"u8); + writer.WriteStartArray(); + foreach (var item in Sentences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentimentActionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentActionResult(document.RootElement, options); + } + + internal static SentimentActionResult DeserializeSentimentActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DocumentSentiment sentiment = default; + SentimentConfidenceScores confidenceScores = default; + IReadOnlyList sentences = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToDocumentSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceSentiment.DeserializeSentenceSentiment(item, options)); + } + sentences = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentActionResult( + id, + warnings, + statistics, + sentiment, + confidenceScores, + sentences, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentActionResult)} does not support writing '{options.Format}' format."); + } + } + + SentimentActionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentActionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentActionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentActionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentActionResult.cs new file mode 100644 index 000000000000..aedb0ff23fc0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentActionResult.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Sentiment analysis per document. + public partial class SentimentActionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// , , or is null. + internal SentimentActionResult(string id, IEnumerable warnings, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IEnumerable sentences) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(sentences, nameof(sentences)); + + Id = id; + Warnings = warnings.ToList(); + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal SentimentActionResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IReadOnlyList sentences, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentimentActionResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + public DocumentSentiment Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The document's sentences sentiment. + public IReadOnlyList Sentences { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisActionContent.Serialization.cs new file mode 100644 index 000000000000..90e926d4fbfd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisActionContent.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentimentAnalysisActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + if (Optional.IsDefined(ModelVersion)) + { + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + } + if (Optional.IsDefined(OpinionMining)) + { + writer.WritePropertyName("opinionMining"u8); + writer.WriteBooleanValue(OpinionMining.Value); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentimentAnalysisActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentAnalysisActionContent(document.RootElement, options); + } + + internal static SentimentAnalysisActionContent DeserializeSentimentAnalysisActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + bool? opinionMining = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("opinionMining"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + opinionMining = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentAnalysisActionContent(loggingOptOut, modelVersion, opinionMining, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support writing '{options.Format}' format."); + } + } + + SentimentAnalysisActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentAnalysisActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentAnalysisActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentAnalysisActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisActionContent.cs new file mode 100644 index 000000000000..af49419a1dd2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisActionContent.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Supported parameters for a Sentiment Analysis task. + public partial class SentimentAnalysisActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SentimentAnalysisActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Whether to use opinion mining in the request or not. + /// Specifies the method used to interpret string offsets. + /// Keeps track of any properties unknown to the library. + internal SentimentAnalysisActionContent(bool? loggingOptOut, string modelVersion, bool? opinionMining, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + OpinionMining = opinionMining; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Whether to use opinion mining in the request or not. + public bool? OpinionMining { get; set; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisOperationAction.Serialization.cs new file mode 100644 index 000000000000..47b3456d3e88 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisOperationAction.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentimentAnalysisOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + SentimentAnalysisOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentAnalysisOperationAction(document.RootElement, options); + } + + internal static SentimentAnalysisOperationAction DeserializeSentimentAnalysisOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SentimentAnalysisActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = SentimentAnalysisActionContent.DeserializeSentimentAnalysisActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentAnalysisOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support writing '{options.Format}' format."); + } + } + + SentimentAnalysisOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentAnalysisOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SentimentAnalysisOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentAnalysisOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisOperationAction.cs new file mode 100644 index 000000000000..0cb3c79e5015 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentAnalysisOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// An object representing the task definition for a Sentiment Analysis task. + public partial class SentimentAnalysisOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public SentimentAnalysisOperationAction() + { + Kind = AnalyzeTextOperationActionKind.SentimentAnalysis; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Sentiment Analysis task. + internal SentimentAnalysisOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, SentimentAnalysisActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Sentiment Analysis task. + public SentimentAnalysisActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentConfidenceScores.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentConfidenceScores.Serialization.cs new file mode 100644 index 000000000000..37f498b66b0a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentConfidenceScores.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentimentConfidenceScores : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("positive"u8); + writer.WriteNumberValue(Positive); + writer.WritePropertyName("neutral"u8); + writer.WriteNumberValue(Neutral); + writer.WritePropertyName("negative"u8); + writer.WriteNumberValue(Negative); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentimentConfidenceScores IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentConfidenceScores(document.RootElement, options); + } + + internal static SentimentConfidenceScores DeserializeSentimentConfidenceScores(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double positive = default; + double neutral = default; + double negative = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("positive"u8)) + { + positive = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("neutral"u8)) + { + neutral = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("negative"u8)) + { + negative = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentConfidenceScores(positive, neutral, negative, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support writing '{options.Format}' format."); + } + } + + SentimentConfidenceScores IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentConfidenceScores(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentConfidenceScores FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentConfidenceScores(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentConfidenceScores.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentConfidenceScores.cs new file mode 100644 index 000000000000..486584fdadd8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentConfidenceScores.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative. + public partial class SentimentConfidenceScores + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for neutral sentiment. + /// Confidence score for negative sentiment. + internal SentimentConfidenceScores(double positive, double neutral, double negative) + { + Positive = positive; + Neutral = neutral; + Negative = negative; + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for neutral sentiment. + /// Confidence score for negative sentiment. + /// Keeps track of any properties unknown to the library. + internal SentimentConfidenceScores(double positive, double neutral, double negative, IDictionary serializedAdditionalRawData) + { + Positive = positive; + Neutral = neutral; + Negative = negative; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentimentConfidenceScores() + { + } + + /// Confidence score for positive sentiment. + public double Positive { get; } + /// Confidence score for neutral sentiment. + public double Neutral { get; } + /// Confidence score for negative sentiment. + public double Negative { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentOperationResult.Serialization.cs new file mode 100644 index 000000000000..ada48fb7bd8e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentOperationResult.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentimentOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + } + + SentimentOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentOperationResult(document.RootElement, options); + } + + internal static SentimentOperationResult DeserializeSentimentOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SentimentResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = SentimentResult.DeserializeSentimentResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support writing '{options.Format}' format."); + } + } + + SentimentOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SentimentOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentOperationResult.cs new file mode 100644 index 000000000000..89bbef769913 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the Sentiment Analysis LRO results. + public partial class SentimentOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// The sentiment analysis results. + /// is null. + internal SentimentOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, SentimentResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.SentimentAnalysisOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// The sentiment analysis results. + internal SentimentOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, SentimentResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal SentimentOperationResult() + { + } + + /// The sentiment analysis results. + public SentimentResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentResult.Serialization.cs new file mode 100644 index 000000000000..b1c1daf3f905 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentResult.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SentimentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SentimentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentResult(document.RootElement, options); + } + + internal static SentimentResult DeserializeSentimentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentimentActionResult.DeserializeSentimentActionResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentResult)} does not support writing '{options.Format}' format."); + } + } + + SentimentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentResult.cs new file mode 100644 index 000000000000..d37fc358c352 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SentimentResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + /// Sentiment analysis results for the input documents. + public partial class SentimentResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// The sentiment analysis results for each document in the input. + /// , or is null. + internal SentimentResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// The sentiment analysis results for each document in the input. + /// Keeps track of any properties unknown to the library. + internal SentimentResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentimentResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// The sentiment analysis results for each document in the input. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedMetadata.Serialization.cs new file mode 100644 index 000000000000..e90c9ce81f97 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SpeedMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + SpeedMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSpeedMetadata(document.RootElement, options); + } + + internal static SpeedMetadata DeserializeSpeedMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + SpeedUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new SpeedUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SpeedMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support writing '{options.Format}' format."); + } + } + + SpeedMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSpeedMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SpeedMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSpeedMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedMetadata.cs new file mode 100644 index 000000000000..06e63621b84b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Speed entity Metadata model. + public partial class SpeedMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for speed. + internal SpeedMetadata(double value, SpeedUnit unit) + { + MetadataKind = MetadataKind.SpeedMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for speed. + internal SpeedMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, SpeedUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal SpeedMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for speed. + public SpeedUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedUnit.cs new file mode 100644 index 000000000000..5dde3b465cce --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SpeedUnit.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The speed Unit of measurement. + public readonly partial struct SpeedUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SpeedUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string MetersPerSecondValue = "MetersPerSecond"; + private const string KilometersPerHourValue = "KilometersPerHour"; + private const string KilometersPerMinuteValue = "KilometersPerMinute"; + private const string KilometersPerSecondValue = "KilometersPerSecond"; + private const string MilesPerHourValue = "MilesPerHour"; + private const string KnotsValue = "Knots"; + private const string FeetPerSecondValue = "FeetPerSecond"; + private const string FeetPerMinuteValue = "FeetPerMinute"; + private const string YardsPerMinuteValue = "YardsPerMinute"; + private const string YardsPerSecondValue = "YardsPerSecond"; + private const string MetersPerMillisecondValue = "MetersPerMillisecond"; + private const string CentimetersPerMillisecondValue = "CentimetersPerMillisecond"; + private const string KilometersPerMillisecondValue = "KilometersPerMillisecond"; + + /// Unspecified speed unit. + public static SpeedUnit Unspecified { get; } = new SpeedUnit(UnspecifiedValue); + /// Speed unit in meters per second. + public static SpeedUnit MetersPerSecond { get; } = new SpeedUnit(MetersPerSecondValue); + /// Speed unit in kilometers per hour. + public static SpeedUnit KilometersPerHour { get; } = new SpeedUnit(KilometersPerHourValue); + /// Speed unit in kilometers per minute. + public static SpeedUnit KilometersPerMinute { get; } = new SpeedUnit(KilometersPerMinuteValue); + /// Speed unit in kilometers per second. + public static SpeedUnit KilometersPerSecond { get; } = new SpeedUnit(KilometersPerSecondValue); + /// Speed unit in miles per hour. + public static SpeedUnit MilesPerHour { get; } = new SpeedUnit(MilesPerHourValue); + /// Speed unit in knots. + public static SpeedUnit Knots { get; } = new SpeedUnit(KnotsValue); + /// Speed unit in feet per second. + public static SpeedUnit FeetPerSecond { get; } = new SpeedUnit(FeetPerSecondValue); + /// Speed unit in feet per minute. + public static SpeedUnit FeetPerMinute { get; } = new SpeedUnit(FeetPerMinuteValue); + /// Speed unit in yards per minute. + public static SpeedUnit YardsPerMinute { get; } = new SpeedUnit(YardsPerMinuteValue); + /// Speed unit in yards per second. + public static SpeedUnit YardsPerSecond { get; } = new SpeedUnit(YardsPerSecondValue); + /// Speed unit in meters per millisecond. + public static SpeedUnit MetersPerMillisecond { get; } = new SpeedUnit(MetersPerMillisecondValue); + /// Speed unit in centimeters per millisecond. + public static SpeedUnit CentimetersPerMillisecond { get; } = new SpeedUnit(CentimetersPerMillisecondValue); + /// Speed unit in Kilometers per millisecond. + public static SpeedUnit KilometersPerMillisecond { get; } = new SpeedUnit(KilometersPerMillisecondValue); + /// Determines if two values are the same. + public static bool operator ==(SpeedUnit left, SpeedUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SpeedUnit left, SpeedUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SpeedUnit(string value) => new SpeedUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SpeedUnit other && Equals(other); + /// + public bool Equals(SpeedUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/StringIndexType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/StringIndexType.cs new file mode 100644 index 000000000000..766f00fd231a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/StringIndexType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Specifies the method used to interpret string offsets. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + public readonly partial struct StringIndexType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StringIndexType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TextElementsV8Value = "TextElements_v8"; + private const string UnicodeCodePointValue = "UnicodeCodePoint"; + private const string Utf16CodeUnitValue = "Utf16CodeUnit"; + + /// Returned offset and length values will correspond to TextElements (Graphemes and Grapheme clusters) confirming to the Unicode 8.0.0 standard. Use this option if your application is written in .Net Framework or .Net Core and you will be using StringInfo. + public static StringIndexType TextElementsV8 { get; } = new StringIndexType(TextElementsV8Value); + /// Returned offset and length values will correspond to Unicode code points. Use this option if your application is written in a language that support Unicode, for example Python. + public static StringIndexType UnicodeCodePoint { get; } = new StringIndexType(UnicodeCodePointValue); + /// Returned offset and length values will correspond to UTF-16 code units. Use this option if your application is written in a language that support Unicode, for example Java, JavaScript. + public static StringIndexType Utf16CodeUnit { get; } = new StringIndexType(Utf16CodeUnitValue); + /// Determines if two values are the same. + public static bool operator ==(StringIndexType left, StringIndexType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StringIndexType left, StringIndexType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StringIndexType(string value) => new StringIndexType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StringIndexType other && Equals(other); + /// + public bool Equals(StringIndexType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryContext.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryContext.Serialization.cs new file mode 100644 index 000000000000..de77617c3816 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryContext.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class SummaryContext : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummaryContext)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SummaryContext IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummaryContext)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSummaryContext(document.RootElement, options); + } + + internal static SummaryContext DeserializeSummaryContext(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SummaryContext(offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SummaryContext)} does not support writing '{options.Format}' format."); + } + } + + SummaryContext IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSummaryContext(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SummaryContext)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SummaryContext FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSummaryContext(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryContext.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryContext.cs new file mode 100644 index 000000000000..37198862d10c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryContext.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The context of the summary. + public partial class SummaryContext + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + internal SummaryContext(int offset, int length) + { + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// Keeps track of any properties unknown to the library. + internal SummaryContext(int offset, int length, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SummaryContext() + { + } + + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryLengthBucket.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryLengthBucket.cs new file mode 100644 index 000000000000..70401fd31752 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/SummaryLengthBucket.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Enum that defines the length of the output summaries. + public readonly partial struct SummaryLengthBucket : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SummaryLengthBucket(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ShortValue = "short"; + private const string MediumValue = "medium"; + private const string LongValue = "long"; + + /// Instructs model to generate shorter length summaries. + public static SummaryLengthBucket Short { get; } = new SummaryLengthBucket(ShortValue); + /// Instructs model to generate medium length summaries. + public static SummaryLengthBucket Medium { get; } = new SummaryLengthBucket(MediumValue); + /// Instructs model to generate longer length summaries. + public static SummaryLengthBucket Long { get; } = new SummaryLengthBucket(LongValue); + /// Determines if two values are the same. + public static bool operator ==(SummaryLengthBucket left, SummaryLengthBucket right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SummaryLengthBucket left, SummaryLengthBucket right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SummaryLengthBucket(string value) => new SummaryLengthBucket(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SummaryLengthBucket other && Equals(other); + /// + public bool Equals(SummaryLengthBucket other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetConfidenceScoreLabel.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetConfidenceScoreLabel.Serialization.cs new file mode 100644 index 000000000000..6cac0599ba87 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetConfidenceScoreLabel.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TargetConfidenceScoreLabel : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("positive"u8); + writer.WriteNumberValue(Positive); + writer.WritePropertyName("negative"u8); + writer.WriteNumberValue(Negative); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TargetConfidenceScoreLabel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetConfidenceScoreLabel(document.RootElement, options); + } + + internal static TargetConfidenceScoreLabel DeserializeTargetConfidenceScoreLabel(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double positive = default; + double negative = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("positive"u8)) + { + positive = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("negative"u8)) + { + negative = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetConfidenceScoreLabel(positive, negative, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support writing '{options.Format}' format."); + } + } + + TargetConfidenceScoreLabel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetConfidenceScoreLabel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TargetConfidenceScoreLabel FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTargetConfidenceScoreLabel(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetConfidenceScoreLabel.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetConfidenceScoreLabel.cs new file mode 100644 index 000000000000..bc1adc29da32 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetConfidenceScoreLabel.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the confidence scores across all sentiment classes: positive and negative. + public partial class TargetConfidenceScoreLabel + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for negative sentiment. + internal TargetConfidenceScoreLabel(double positive, double negative) + { + Positive = positive; + Negative = negative; + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for negative sentiment. + /// Keeps track of any properties unknown to the library. + internal TargetConfidenceScoreLabel(double positive, double negative, IDictionary serializedAdditionalRawData) + { + Positive = positive; + Negative = negative; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetConfidenceScoreLabel() + { + } + + /// Confidence score for positive sentiment. + public double Positive { get; } + /// Confidence score for negative sentiment. + public double Negative { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelation.Serialization.cs new file mode 100644 index 000000000000..72fb0c8daf62 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelation.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TargetRelation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetRelation)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("ref"u8); + writer.WriteStringValue(Ref); + writer.WritePropertyName("relationType"u8); + writer.WriteStringValue(RelationType.ToSerialString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TargetRelation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetRelation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetRelation(document.RootElement, options); + } + + internal static TargetRelation DeserializeTargetRelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @ref = default; + TargetRelationType relationType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ref"u8)) + { + @ref = property.Value.GetString(); + continue; + } + if (property.NameEquals("relationType"u8)) + { + relationType = property.Value.GetString().ToTargetRelationType(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetRelation(@ref, relationType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetRelation)} does not support writing '{options.Format}' format."); + } + } + + TargetRelation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetRelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetRelation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TargetRelation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTargetRelation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelation.cs new file mode 100644 index 000000000000..e434906031ef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelation.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the relation between assessments and/or targets. + public partial class TargetRelation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The JSON pointer indicating the linked object. + /// The type related to the target. + /// is null. + internal TargetRelation(string @ref, TargetRelationType relationType) + { + Argument.AssertNotNull(@ref, nameof(@ref)); + + Ref = @ref; + RelationType = relationType; + } + + /// Initializes a new instance of . + /// The JSON pointer indicating the linked object. + /// The type related to the target. + /// Keeps track of any properties unknown to the library. + internal TargetRelation(string @ref, TargetRelationType relationType, IDictionary serializedAdditionalRawData) + { + Ref = @ref; + RelationType = relationType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetRelation() + { + } + + /// The JSON pointer indicating the linked object. + public string Ref { get; } + /// The type related to the target. + public TargetRelationType RelationType { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelationType.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelationType.Serialization.cs new file mode 100644 index 000000000000..f64549d1a899 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelationType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class TargetRelationTypeExtensions + { + public static string ToSerialString(this TargetRelationType value) => value switch + { + TargetRelationType.Assessment => "assessment", + TargetRelationType.Target => "target", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TargetRelationType value.") + }; + + public static TargetRelationType ToTargetRelationType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "assessment")) return TargetRelationType.Assessment; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "target")) return TargetRelationType.Target; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TargetRelationType value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelationType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelationType.cs new file mode 100644 index 000000000000..937178c6f338 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TargetRelationType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// The type related to the target. + public enum TargetRelationType + { + /// Assessment relation. + Assessment, + /// Target relation. + Target + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureMetadata.Serialization.cs new file mode 100644 index 000000000000..f5defb5d0b8f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TemperatureMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + TemperatureMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemperatureMetadata(document.RootElement, options); + } + + internal static TemperatureMetadata DeserializeTemperatureMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + TemperatureUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new TemperatureUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemperatureMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support writing '{options.Format}' format."); + } + } + + TemperatureMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemperatureMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemperatureMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemperatureMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureMetadata.cs new file mode 100644 index 000000000000..696b7e3e2c26 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Information entity Metadata model. + public partial class TemperatureMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for temperature. + internal TemperatureMetadata(double value, TemperatureUnit unit) + { + MetadataKind = MetadataKind.TemperatureMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for temperature. + internal TemperatureMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, TemperatureUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal TemperatureMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for temperature. + public TemperatureUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureUnit.cs new file mode 100644 index 000000000000..4660e11e9d60 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemperatureUnit.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The temperature Unit of measurement. + public readonly partial struct TemperatureUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemperatureUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string FahrenheitValue = "Fahrenheit"; + private const string KelvinValue = "Kelvin"; + private const string RankineValue = "Rankine"; + private const string CelsiusValue = "Celsius"; + + /// Unspecified temperature unit. + public static TemperatureUnit Unspecified { get; } = new TemperatureUnit(UnspecifiedValue); + /// Temperature unit in Fahrenheit. + public static TemperatureUnit Fahrenheit { get; } = new TemperatureUnit(FahrenheitValue); + /// Temperature unit in Kelvin. + public static TemperatureUnit Kelvin { get; } = new TemperatureUnit(KelvinValue); + /// Temperature unit in Rankine. + public static TemperatureUnit Rankine { get; } = new TemperatureUnit(RankineValue); + /// Temperature unit in Celsius. + public static TemperatureUnit Celsius { get; } = new TemperatureUnit(CelsiusValue); + /// Determines if two values are the same. + public static bool operator ==(TemperatureUnit left, TemperatureUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemperatureUnit left, TemperatureUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TemperatureUnit(string value) => new TemperatureUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemperatureUnit other && Equals(other); + /// + public bool Equals(TemperatureUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalModifier.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalModifier.cs new file mode 100644 index 000000000000..cf514d9fdf4e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalModifier.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// An optional modifier of a date/time instance. + public readonly partial struct TemporalModifier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemporalModifier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AfterApproxValue = "AfterApprox"; + private const string BeforeValue = "Before"; + private const string BeforeStartValue = "BeforeStart"; + private const string ApproxValue = "Approx"; + private const string ReferenceUndefinedValue = "ReferenceUndefined"; + private const string SinceEndValue = "SinceEnd"; + private const string AfterMidValue = "AfterMid"; + private const string StartValue = "Start"; + private const string AfterValue = "After"; + private const string BeforeEndValue = "BeforeEnd"; + private const string UntilValue = "Until"; + private const string EndValue = "End"; + private const string LessValue = "Less"; + private const string SinceValue = "Since"; + private const string AfterStartValue = "AfterStart"; + private const string BeforeApproxValue = "BeforeApprox"; + private const string MidValue = "Mid"; + private const string MoreValue = "More"; + + /// After an approximate time. + public static TemporalModifier AfterApprox { get; } = new TemporalModifier(AfterApproxValue); + /// Before a specific time. + public static TemporalModifier Before { get; } = new TemporalModifier(BeforeValue); + /// Before the start of a time period. + public static TemporalModifier BeforeStart { get; } = new TemporalModifier(BeforeStartValue); + /// Approximately at a specific time. + public static TemporalModifier Approx { get; } = new TemporalModifier(ApproxValue); + /// Reference to an undefined time. + public static TemporalModifier ReferenceUndefined { get; } = new TemporalModifier(ReferenceUndefinedValue); + /// Since the end of a time period. + public static TemporalModifier SinceEnd { get; } = new TemporalModifier(SinceEndValue); + /// After the middle of a time period. + public static TemporalModifier AfterMid { get; } = new TemporalModifier(AfterMidValue); + /// At the start of a time period. + public static TemporalModifier Start { get; } = new TemporalModifier(StartValue); + /// After a specific time. + public static TemporalModifier After { get; } = new TemporalModifier(AfterValue); + /// Before the end of a time period. + public static TemporalModifier BeforeEnd { get; } = new TemporalModifier(BeforeEndValue); + /// Until a specific time. + public static TemporalModifier Until { get; } = new TemporalModifier(UntilValue); + /// At the end of a time period. + public static TemporalModifier End { get; } = new TemporalModifier(EndValue); + /// Less than a specific time. + public static TemporalModifier Less { get; } = new TemporalModifier(LessValue); + /// Since a specific time. + public static TemporalModifier Since { get; } = new TemporalModifier(SinceValue); + /// After the start of a time period. + public static TemporalModifier AfterStart { get; } = new TemporalModifier(AfterStartValue); + /// Before an approximate time. + public static TemporalModifier BeforeApprox { get; } = new TemporalModifier(BeforeApproxValue); + /// In the middle of a time period. + public static TemporalModifier Mid { get; } = new TemporalModifier(MidValue); + /// More than a specific time. + public static TemporalModifier More { get; } = new TemporalModifier(MoreValue); + /// Determines if two values are the same. + public static bool operator ==(TemporalModifier left, TemporalModifier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemporalModifier left, TemporalModifier right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TemporalModifier(string value) => new TemporalModifier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemporalModifier other && Equals(other); + /// + public bool Equals(TemporalModifier other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSetMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSetMetadata.Serialization.cs new file mode 100644 index 000000000000..488250745daf --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSetMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TemporalSetMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + } + + TemporalSetMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSetMetadata(document.RootElement, options); + } + + internal static TemporalSetMetadata DeserializeTemporalSetMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSetMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support writing '{options.Format}' format."); + } + } + + TemporalSetMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemporalSetMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemporalSetMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSetMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSetMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSetMetadata.cs new file mode 100644 index 000000000000..e25b07062620 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSetMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A Metadata for temporal set entity instances. + public partial class TemporalSetMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal TemporalSetMetadata() + { + MetadataKind = MetadataKind.TemporalSetMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal TemporalSetMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanMetadata.Serialization.cs new file mode 100644 index 000000000000..d68e5ed5d7a1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TemporalSpanMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(SpanValues)) + { + writer.WritePropertyName("spanValues"u8); + writer.WriteStartArray(); + foreach (var item in SpanValues) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + } + + TemporalSpanMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSpanMetadata(document.RootElement, options); + } + + internal static TemporalSpanMetadata DeserializeTemporalSpanMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList spanValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("spanValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TemporalSpanValues.DeserializeTemporalSpanValues(item, options)); + } + spanValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSpanMetadata(metadataKind, serializedAdditionalRawData, spanValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support writing '{options.Format}' format."); + } + } + + TemporalSpanMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemporalSpanMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemporalSpanMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSpanMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanMetadata.cs new file mode 100644 index 000000000000..b0356937f66d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// represents the Metadata of a date and/or time span. + public partial class TemporalSpanMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal TemporalSpanMetadata() + { + MetadataKind = MetadataKind.TemporalSpanMetadata; + SpanValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of temporal spans detected. + internal TemporalSpanMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList spanValues) : base(metadataKind, serializedAdditionalRawData) + { + SpanValues = spanValues; + } + + /// List of temporal spans detected. + public IReadOnlyList SpanValues { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanValues.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanValues.Serialization.cs new file mode 100644 index 000000000000..1c6156aa8d8c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanValues.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TemporalSpanValues : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Begin)) + { + writer.WritePropertyName("begin"u8); + writer.WriteStringValue(Begin); + } + if (Optional.IsDefined(End)) + { + writer.WritePropertyName("end"u8); + writer.WriteStringValue(End); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(Modifier)) + { + writer.WritePropertyName("modifier"u8); + writer.WriteStringValue(Modifier.Value.ToString()); + } + if (Optional.IsDefined(Timex)) + { + writer.WritePropertyName("timex"u8); + writer.WriteStringValue(Timex); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TemporalSpanValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSpanValues(document.RootElement, options); + } + + internal static TemporalSpanValues DeserializeTemporalSpanValues(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string begin = default; + string end = default; + string duration = default; + TemporalModifier? modifier = default; + string timex = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("begin"u8)) + { + begin = property.Value.GetString(); + continue; + } + if (property.NameEquals("end"u8)) + { + end = property.Value.GetString(); + continue; + } + if (property.NameEquals("duration"u8)) + { + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("modifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifier = new TemporalModifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("timex"u8)) + { + timex = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSpanValues( + begin, + end, + duration, + modifier, + timex, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support writing '{options.Format}' format."); + } + } + + TemporalSpanValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemporalSpanValues(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TemporalSpanValues FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSpanValues(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanValues.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanValues.cs new file mode 100644 index 000000000000..95f55d4c7651 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TemporalSpanValues.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Temporal span object. + public partial class TemporalSpanValues + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TemporalSpanValues() + { + } + + /// Initializes a new instance of . + /// Start value for the span. + /// End value for the span. + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + /// Modifier for datetime to indicate point of reference like before, after etc. + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + /// Keeps track of any properties unknown to the library. + internal TemporalSpanValues(string begin, string end, string duration, TemporalModifier? modifier, string timex, IDictionary serializedAdditionalRawData) + { + Begin = begin; + End = end; + Duration = duration; + Modifier = modifier; + Timex = timex; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Start value for the span. + public string Begin { get; } + /// End value for the span. + public string End { get; } + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + public string Duration { get; } + /// Modifier for datetime to indicate point of reference like before, after etc. + public TemporalModifier? Modifier { get; } + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + public string Timex { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActionState.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActionState.cs new file mode 100644 index 000000000000..9fcd40cc40bc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActionState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The status of the task at the mentioned last update time. + public readonly partial struct TextActionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TextActionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "notStarted"; + private const string RunningValue = "running"; + private const string SucceededValue = "succeeded"; + private const string PartiallyCompletedValue = "partiallyCompleted"; + private const string FailedValue = "failed"; + private const string CancelledValue = "cancelled"; + private const string CancellingValue = "cancelling"; + + /// Not started status. + public static TextActionState NotStarted { get; } = new TextActionState(NotStartedValue); + /// Running status. + public static TextActionState Running { get; } = new TextActionState(RunningValue); + /// Succeeded status. + public static TextActionState Succeeded { get; } = new TextActionState(SucceededValue); + /// Partially completed status. + public static TextActionState PartiallyCompleted { get; } = new TextActionState(PartiallyCompletedValue); + /// Failed status. + public static TextActionState Failed { get; } = new TextActionState(FailedValue); + /// Cancelled status. + public static TextActionState Cancelled { get; } = new TextActionState(CancelledValue); + /// Cancelling status. + public static TextActionState Cancelling { get; } = new TextActionState(CancellingValue); + /// Determines if two values are the same. + public static bool operator ==(TextActionState left, TextActionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TextActionState left, TextActionState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TextActionState(string value) => new TextActionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TextActionState other && Equals(other); + /// + public bool Equals(TextActionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActions.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActions.Serialization.cs new file mode 100644 index 000000000000..0b7f2f4f60c5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActions.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextActions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextActions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("completed"u8); + writer.WriteNumberValue(Completed); + writer.WritePropertyName("failed"u8); + writer.WriteNumberValue(Failed); + writer.WritePropertyName("inProgress"u8); + writer.WriteNumberValue(InProgress); + writer.WritePropertyName("total"u8); + writer.WriteNumberValue(Total); + if (Optional.IsCollectionDefined(Items)) + { + writer.WritePropertyName("items"u8); + writer.WriteStartArray(); + foreach (var item in Items) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TextActions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextActions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextActions(document.RootElement, options); + } + + internal static TextActions DeserializeTextActions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int completed = default; + int failed = default; + int inProgress = default; + int total = default; + IReadOnlyList items = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("completed"u8)) + { + completed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("failed"u8)) + { + failed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("inProgress"u8)) + { + inProgress = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("total"u8)) + { + total = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("items"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeTextOperationResult.DeserializeAnalyzeTextOperationResult(item, options)); + } + items = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextActions( + completed, + failed, + inProgress, + total, + items ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextActions)} does not support writing '{options.Format}' format."); + } + } + + TextActions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextActions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextActions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TextActions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextActions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActions.cs new file mode 100644 index 000000000000..ddd7ff50c503 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextActions.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Container for the tasks status for the LRO job. + public partial class TextActions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + internal TextActions(int completed, int failed, int inProgress, int total) + { + Completed = completed; + Failed = failed; + InProgress = inProgress; + Total = total; + Items = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + /// + /// Enumerable of Analyze text job results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal TextActions(int completed, int failed, int inProgress, int total, IReadOnlyList items, IDictionary serializedAdditionalRawData) + { + Completed = completed; + Failed = failed; + InProgress = inProgress; + Total = total; + Items = items; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextActions() + { + } + + /// Count of completed tasks. + public int Completed { get; } + /// Count of failed tasks. + public int Failed { get; } + /// Count of inprogress tasks. + public int InProgress { get; } + /// Count of total tasks. + public int Total { get; } + /// + /// Enumerable of Analyze text job results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public IReadOnlyList Items { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs new file mode 100644 index 000000000000..c07484d93b7f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs @@ -0,0 +1,596 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.Text +{ + // Data plane generated client. + /// The language service API is a suite of natural language processing (NLP) skills 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, language detection and question answering. Further documentation can be found in <a href=\"https://docs.microsoft.com/azure/cognitive-services/language-service/overview\">https://docs.microsoft.com/azure/cognitive-services/language-service/overview</a>.0. + public partial class TextAnalysisClient + { + private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; + private readonly AzureKeyCredential _keyCredential; + private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of TextAnalysisClient for mocking. + protected TextAnalysisClient() + { + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// or is null. + public TextAnalysisClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new TextAnalysisClientOptions()) + { + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// or is null. + public TextAnalysisClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new TextAnalysisClientOptions()) + { + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public TextAnalysisClient(Uri endpoint, AzureKeyCredential credential, TextAnalysisClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new TextAnalysisClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _keyCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public TextAnalysisClient(Uri endpoint, TokenCredential credential, TextAnalysisClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new TextAnalysisClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Request text analysis over a collection of documents. + /// The input documents to analyze. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> AnalyzeTextAsync(AnalyzeTextInput analyzeTextInput, bool? showStatistics = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(analyzeTextInput, nameof(analyzeTextInput)); + + using RequestContent content = analyzeTextInput.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeTextAsync(content, showStatistics, context).ConfigureAwait(false); + return Response.FromValue(AnalyzeTextResult.FromResponse(response), response); + } + + /// Request text analysis over a collection of documents. + /// The input documents to analyze. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The cancellation token to use. + /// is null. + /// + public virtual Response AnalyzeText(AnalyzeTextInput analyzeTextInput, bool? showStatistics = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(analyzeTextInput, nameof(analyzeTextInput)); + + using RequestContent content = analyzeTextInput.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeText(content, showStatistics, context); + return Response.FromValue(AnalyzeTextResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Request text analysis over a collection of documents. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AnalyzeTextAsync(RequestContent content, bool? showStatistics = null, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeText"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextRequest(content, showStatistics, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Request text analysis over a collection of documents. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AnalyzeText(RequestContent content, bool? showStatistics = null, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeText"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextRequest(content, showStatistics, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get analysis status and results. + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The cancellation token to use. + /// Get the status of an analysis job. A job can consist of one or more tasks. After all tasks succeed, the job transitions to the succeeded state and results are available for each task. + /// + public virtual async Task> AnalyzeTextOperationStatusAsync(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeTextOperationStatusAsync(jobId, showStats, top, skip, context).ConfigureAwait(false); + return Response.FromValue(AnalyzeTextOperationState.FromResponse(response), response); + } + + /// Get analysis status and results. + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The cancellation token to use. + /// Get the status of an analysis job. A job can consist of one or more tasks. After all tasks succeed, the job transitions to the succeeded state and results are available for each task. + /// + public virtual Response AnalyzeTextOperationStatus(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeTextOperationStatus(jobId, showStats, top, skip, context); + return Response.FromValue(AnalyzeTextOperationState.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get analysis status and results + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AnalyzeTextOperationStatusAsync(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextOperationStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextOperationStatusRequest(jobId, showStats, top, skip, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get analysis status and results + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AnalyzeTextOperationStatus(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextOperationStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextOperationStatusRequest(jobId, showStats, top, skip, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Contains the input to be analyzed. + /// List of tasks to be performed as part of the LRO. + /// Name for the task. + /// Default language to use for records requesting automatic language detection. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task AnalyzeTextSubmitOperationAsync(WaitUntil waitUntil, MultiLanguageTextInput textInput, IEnumerable actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(textInput, nameof(textInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + AnalyzeTextSubmitJobRequest analyzeTextSubmitJobRequest = new AnalyzeTextSubmitJobRequest(displayName, textInput, actions.ToList(), defaultLanguage, null); + RequestContext context = FromCancellationToken(cancellationToken); + return await AnalyzeTextSubmitOperationAsync(waitUntil, analyzeTextSubmitJobRequest.ToRequestContent(), context).ConfigureAwait(false); + } + + /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Contains the input to be analyzed. + /// List of tasks to be performed as part of the LRO. + /// Name for the task. + /// Default language to use for records requesting automatic language detection. + /// The cancellation token to use. + /// or is null. + /// + public virtual Operation AnalyzeTextSubmitOperation(WaitUntil waitUntil, MultiLanguageTextInput textInput, IEnumerable actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(textInput, nameof(textInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + AnalyzeTextSubmitJobRequest analyzeTextSubmitJobRequest = new AnalyzeTextSubmitJobRequest(displayName, textInput, actions.ToList(), defaultLanguage, null); + RequestContext context = FromCancellationToken(cancellationToken); + return AnalyzeTextSubmitOperation(waitUntil, analyzeTextSubmitJobRequest.ToRequestContent(), context); + } + + /// + /// [Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task AnalyzeTextSubmitOperationAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextSubmitOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextSubmitOperationRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextSubmitOperation", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation AnalyzeTextSubmitOperation(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextSubmitOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextSubmitOperationRequest(content, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextSubmitOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Cancel a long-running Text Analysis job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The job ID to cancel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task AnalyzeTextCancelOperationAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextCancelOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextCancelOperationRequest(jobId, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Cancel a long-running Text Analysis job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The job ID to cancel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation AnalyzeTextCancelOperation(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextCancelOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextCancelOperationRequest(jobId, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateAnalyzeTextRequest(RequestContent content, bool? showStatistics, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/:analyze-text", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (showStatistics != null) + { + uri.AppendQuery("showStats", showStatistics.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAnalyzeTextOperationStatusRequest(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/analyze-text/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (showStats != null) + { + uri.AppendQuery("showStats", showStats.Value, true); + } + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateAnalyzeTextSubmitOperationRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/analyze-text/jobs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAnalyzeTextCancelOperationRequest(Guid jobId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/analyze-text/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendPath(":cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier202; + private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs new file mode 100644 index 000000000000..b6d48331233c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + /// Client options for TextAnalysisClient. + public partial class TextAnalysisClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2023_11_15_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-05-01". + V2022_05_01 = 1, + /// Service version "2023-04-01". + V2023_04_01 = 2, + /// Service version "2023-11-15-preview". + V2023_11_15_Preview = 3, + } + + internal string Version { get; } + + /// Initializes new instance of TextAnalysisClientOptions. + public TextAnalysisClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_05_01 => "2022-05-01", + ServiceVersion.V2023_04_01 => "2023-04-01", + ServiceVersion.V2023_11_15_Preview => "2023-11-15-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextDynamicClassificationInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextDynamicClassificationInput.Serialization.cs new file mode 100644 index 000000000000..6996da068b41 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextDynamicClassificationInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextDynamicClassificationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextDynamicClassificationInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextDynamicClassificationInput(document.RootElement, options); + } + + internal static TextDynamicClassificationInput DeserializeTextDynamicClassificationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + DynamicClassificationActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = DynamicClassificationActionContent.DeserializeDynamicClassificationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextDynamicClassificationInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support writing '{options.Format}' format."); + } + } + + TextDynamicClassificationInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextDynamicClassificationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextDynamicClassificationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextDynamicClassificationInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextDynamicClassificationInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextDynamicClassificationInput.cs new file mode 100644 index 000000000000..ebe95188402a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextDynamicClassificationInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text dynamic classifications input. + public partial class TextDynamicClassificationInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextDynamicClassificationInput() + { + Kind = AnalyzeTextInputKind.DynamicClassification; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Input to be analyzed. + /// Task parameters. + internal TextDynamicClassificationInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, DynamicClassificationActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Input to be analyzed. + public MultiLanguageTextInput TextInput { get; set; } + /// Task parameters. + public DynamicClassificationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityLinkingInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityLinkingInput.Serialization.cs new file mode 100644 index 000000000000..4268704acccc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityLinkingInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextEntityLinkingInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextEntityLinkingInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextEntityLinkingInput(document.RootElement, options); + } + + internal static TextEntityLinkingInput DeserializeTextEntityLinkingInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + EntityLinkingActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntityLinkingActionContent.DeserializeEntityLinkingActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextEntityLinkingInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support writing '{options.Format}' format."); + } + } + + TextEntityLinkingInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextEntityLinkingInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextEntityLinkingInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextEntityLinkingInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityLinkingInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityLinkingInput.cs new file mode 100644 index 000000000000..dccccce5d60b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityLinkingInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text Entity linking input. + public partial class TextEntityLinkingInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextEntityLinkingInput() + { + Kind = AnalyzeTextInputKind.EntityLinking; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the analysis input to be handled by the service. + /// Task parameters. + internal TextEntityLinkingInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, EntityLinkingActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the analysis input to be handled by the service. + public MultiLanguageTextInput TextInput { get; set; } + /// Task parameters. + public EntityLinkingActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityRecognitionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityRecognitionInput.Serialization.cs new file mode 100644 index 000000000000..43e9c7730ad1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityRecognitionInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextEntityRecognitionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextEntityRecognitionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextEntityRecognitionInput(document.RootElement, options); + } + + internal static TextEntityRecognitionInput DeserializeTextEntityRecognitionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + EntitiesActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntitiesActionContent.DeserializeEntitiesActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextEntityRecognitionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support writing '{options.Format}' format."); + } + } + + TextEntityRecognitionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextEntityRecognitionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextEntityRecognitionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextEntityRecognitionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityRecognitionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityRecognitionInput.cs new file mode 100644 index 000000000000..f654e9206500 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextEntityRecognitionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// The entity recognition analyze text input task request. + public partial class TextEntityRecognitionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextEntityRecognitionInput() + { + Kind = AnalyzeTextInputKind.EntityRecognition; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// The input to be analyzed. + /// Task parameters. + internal TextEntityRecognitionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, EntitiesActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// The input to be analyzed. + public MultiLanguageTextInput TextInput { get; set; } + /// Task parameters. + public EntitiesActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextKeyPhraseExtractionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextKeyPhraseExtractionInput.Serialization.cs new file mode 100644 index 000000000000..a7da45684680 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextKeyPhraseExtractionInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextKeyPhraseExtractionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextKeyPhraseExtractionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextKeyPhraseExtractionInput(document.RootElement, options); + } + + internal static TextKeyPhraseExtractionInput DeserializeTextKeyPhraseExtractionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + KeyPhraseActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = KeyPhraseActionContent.DeserializeKeyPhraseActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextKeyPhraseExtractionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support writing '{options.Format}' format."); + } + } + + TextKeyPhraseExtractionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextKeyPhraseExtractionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextKeyPhraseExtractionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextKeyPhraseExtractionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextKeyPhraseExtractionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextKeyPhraseExtractionInput.cs new file mode 100644 index 000000000000..df384803e2a3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextKeyPhraseExtractionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text KeyPhraseExtraction task input. + public partial class TextKeyPhraseExtractionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextKeyPhraseExtractionInput() + { + Kind = AnalyzeTextInputKind.KeyPhraseExtraction; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the input documents. + /// Key phrase extraction task parameters. + internal TextKeyPhraseExtractionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, KeyPhraseActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the input documents. + public MultiLanguageTextInput TextInput { get; set; } + /// Key phrase extraction task parameters. + public KeyPhraseActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextLanguageDetectionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextLanguageDetectionInput.Serialization.cs new file mode 100644 index 000000000000..fceb1b22db7d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextLanguageDetectionInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextLanguageDetectionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextLanguageDetectionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextLanguageDetectionInput(document.RootElement, options); + } + + internal static TextLanguageDetectionInput DeserializeTextLanguageDetectionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LanguageDetectionTextInput analysisInput = default; + LanguageDetectionActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = LanguageDetectionTextInput.DeserializeLanguageDetectionTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = LanguageDetectionActionContent.DeserializeLanguageDetectionActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextLanguageDetectionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support writing '{options.Format}' format."); + } + } + + TextLanguageDetectionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextLanguageDetectionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextLanguageDetectionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextLanguageDetectionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextLanguageDetectionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextLanguageDetectionInput.cs new file mode 100644 index 000000000000..e35f778bac7a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextLanguageDetectionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the language detection document analysis task input. + public partial class TextLanguageDetectionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextLanguageDetectionInput() + { + Kind = AnalyzeTextInputKind.LanguageDetection; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Documents to be analyzed. + /// task parameters. + internal TextLanguageDetectionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, LanguageDetectionTextInput textInput, LanguageDetectionActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Documents to be analyzed. + public LanguageDetectionTextInput TextInput { get; set; } + /// task parameters. + public LanguageDetectionActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextPiiEntitiesRecognitionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextPiiEntitiesRecognitionInput.Serialization.cs new file mode 100644 index 000000000000..c36f72d213dd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextPiiEntitiesRecognitionInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextPiiEntitiesRecognitionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextPiiEntitiesRecognitionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextPiiEntitiesRecognitionInput(document.RootElement, options); + } + + internal static TextPiiEntitiesRecognitionInput DeserializeTextPiiEntitiesRecognitionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + PiiActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = PiiActionContent.DeserializePiiActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextPiiEntitiesRecognitionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support writing '{options.Format}' format."); + } + } + + TextPiiEntitiesRecognitionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextPiiEntitiesRecognitionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextPiiEntitiesRecognitionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextPiiEntitiesRecognitionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextPiiEntitiesRecognitionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextPiiEntitiesRecognitionInput.cs new file mode 100644 index 000000000000..e1b54bd67ab6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextPiiEntitiesRecognitionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text PIIEntityRecognition task input. + public partial class TextPiiEntitiesRecognitionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextPiiEntitiesRecognitionInput() + { + Kind = AnalyzeTextInputKind.PiiEntityRecognition; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the input documents. + /// Pii task parameters. + internal TextPiiEntitiesRecognitionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, PiiActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the input documents. + public MultiLanguageTextInput TextInput { get; set; } + /// Pii task parameters. + public PiiActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextSentimentAnalysisInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextSentimentAnalysisInput.Serialization.cs new file mode 100644 index 000000000000..0fa1a77b2ea3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextSentimentAnalysisInput.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TextSentimentAnalysisInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + } + + TextSentimentAnalysisInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextSentimentAnalysisInput(document.RootElement, options); + } + + internal static TextSentimentAnalysisInput DeserializeTextSentimentAnalysisInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + SentimentAnalysisActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = SentimentAnalysisActionContent.DeserializeSentimentAnalysisActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextSentimentAnalysisInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support writing '{options.Format}' format."); + } + } + + TextSentimentAnalysisInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextSentimentAnalysisInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextSentimentAnalysisInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextSentimentAnalysisInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextSentimentAnalysisInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextSentimentAnalysisInput.cs new file mode 100644 index 000000000000..2f5f9d225ce3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextSentimentAnalysisInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Contains the analyze text SentimentAnalysis task input. + public partial class TextSentimentAnalysisInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextSentimentAnalysisInput() + { + Kind = AnalyzeTextInputKind.SentimentAnalysis; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the input documents. + /// Sentiment Analysis task parameters. + internal TextSentimentAnalysisInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, SentimentAnalysisActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the input documents. + public MultiLanguageTextInput TextInput { get; set; } + /// Sentiment Analysis task parameters. + public SentimentAnalysisActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TimeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TimeMetadata.Serialization.cs new file mode 100644 index 000000000000..851aa122bfe0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TimeMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class TimeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + } + + TimeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTimeMetadata(document.RootElement, options); + } + + internal static TimeMetadata DeserializeTimeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TimeMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TimeMetadata)} does not support writing '{options.Format}' format."); + } + } + + TimeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTimeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TimeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TimeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTimeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TimeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TimeMetadata.cs new file mode 100644 index 000000000000..6632de20e535 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TimeMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// A Metadata for time entity instances. + public partial class TimeMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal TimeMetadata() + { + MetadataKind = MetadataKind.TimeMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal TimeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TokenSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TokenSentiment.Serialization.cs new file mode 100644 index 000000000000..39e9a3ccf9ee --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TokenSentiment.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text +{ + internal static partial class TokenSentimentExtensions + { + public static string ToSerialString(this TokenSentiment value) => value switch + { + TokenSentiment.Positive => "positive", + TokenSentiment.Mixed => "mixed", + TokenSentiment.Negative => "negative", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TokenSentiment value.") + }; + + public static TokenSentiment ToTokenSentiment(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return TokenSentiment.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "mixed")) return TokenSentiment.Mixed; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return TokenSentiment.Negative; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TokenSentiment value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TokenSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TokenSentiment.cs new file mode 100644 index 000000000000..bdfa8a5159ba --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TokenSentiment.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text +{ + /// The predicted Sentiment for the sentence. + public enum TokenSentiment + { + /// Positive sentiment. + Positive, + /// Mixed sentiment. + Mixed, + /// Negative sentiment. + Negative + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextInput.Serialization.cs new file mode 100644 index 000000000000..3484412936e4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextInput.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownAnalyzeTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AnalyzeTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + + internal static UnknownAnalyzeTextInput DeserializeUnknownAnalyzeTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeTextInputKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextInput(kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextInput.cs new file mode 100644 index 000000000000..455bcb192a8f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextInput.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of AnalyzeTextInput. + internal partial class UnknownAnalyzeTextInput : AnalyzeTextInput + { + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextInput() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationAction.Serialization.cs new file mode 100644 index 000000000000..6fa3d60388c5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationAction.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownAnalyzeTextOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AnalyzeTextOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + + internal static UnknownAnalyzeTextOperationAction DeserializeUnknownAnalyzeTextOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string taskName = default; + AnalyzeTextOperationActionKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextOperationAction(taskName, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationAction.cs new file mode 100644 index 000000000000..0ea36e47e89b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationAction.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of AnalyzeTextOperationAction. + internal partial class UnknownAnalyzeTextOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData) : base(name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextOperationAction() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationResult.Serialization.cs new file mode 100644 index 000000000000..532965803dca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationResult.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownAnalyzeTextOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AnalyzeTextOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + + internal static UnknownAnalyzeTextOperationResult DeserializeUnknownAnalyzeTextOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextOperationResult(lastUpdateDateTime, status, taskName, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationResult.cs new file mode 100644 index 000000000000..5c5ebfb98762 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextOperationResult.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of AnalyzeTextOperationResult. + internal partial class UnknownAnalyzeTextOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextOperationResult() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextResult.Serialization.cs new file mode 100644 index 000000000000..699a185d2112 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextResult.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownAnalyzeTextResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AnalyzeTextResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + + internal static UnknownAnalyzeTextResult DeserializeUnknownAnalyzeTextResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeTextResultsKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextResult(kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextResult.cs new file mode 100644 index 000000000000..ac226747fef8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownAnalyzeTextResult.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of AnalyzeTextResult. + internal partial class UnknownAnalyzeTextResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextResult() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownBaseMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownBaseMetadata.Serialization.cs new file mode 100644 index 000000000000..524a5d36ab84 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownBaseMetadata.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownBaseMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + BaseMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseMetadata(document.RootElement, options); + } + + internal static UnknownBaseMetadata DeserializeUnknownBaseMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MetadataKind metadataKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownBaseMetadata(metadataKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{options.Format}' format."); + } + } + + BaseMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaseMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownBaseMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownBaseMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownBaseMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownBaseMetadata.cs new file mode 100644 index 000000000000..d04734fbbb3a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownBaseMetadata.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of BaseMetadata. + internal partial class UnknownBaseMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownBaseMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData) : base(metadataKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownBaseMetadata() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityComponentInformation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityComponentInformation.Serialization.cs new file mode 100644 index 000000000000..66f57eb2a87b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityComponentInformation.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownEntityComponentInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + EntityComponentInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + + internal static UnknownEntityComponentInformation DeserializeUnknownEntityComponentInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityComponentKind entityComponentKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownEntityComponentInformation(entityComponentKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{options.Format}' format."); + } + } + + EntityComponentInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownEntityComponentInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownEntityComponentInformation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityComponentInformation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityComponentInformation.cs new file mode 100644 index 000000000000..626786867c52 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityComponentInformation.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of EntityComponentInformation. + internal partial class UnknownEntityComponentInformation : EntityComponentInformation + { + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + internal UnknownEntityComponentInformation(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData) : base(entityComponentKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownEntityComponentInformation() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityOverlapPolicy.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityOverlapPolicy.Serialization.cs new file mode 100644 index 000000000000..0a7379c163f1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityOverlapPolicy.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal partial class UnknownEntityOverlapPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + EntityOverlapPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + + internal static UnknownEntityOverlapPolicy DeserializeUnknownEntityOverlapPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyKind policyKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new PolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownEntityOverlapPolicy(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{options.Format}' format."); + } + } + + EntityOverlapPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownEntityOverlapPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownEntityOverlapPolicy(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityOverlapPolicy.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityOverlapPolicy.cs new file mode 100644 index 000000000000..bc186ba22f66 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/UnknownEntityOverlapPolicy.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Unknown version of EntityOverlapPolicy. + internal partial class UnknownEntityOverlapPolicy : EntityOverlapPolicy + { + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownEntityOverlapPolicy(PolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownEntityOverlapPolicy() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeMetadata.Serialization.cs new file mode 100644 index 000000000000..abbdb6b8c9e2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class VolumeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + VolumeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeMetadata(document.RootElement, options); + } + + internal static VolumeMetadata DeserializeVolumeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + VolumeUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new VolumeUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support writing '{options.Format}' format."); + } + } + + VolumeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVolumeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VolumeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeVolumeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeMetadata.cs new file mode 100644 index 000000000000..0c05a5bdda2e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Volume entity Metadata model. + public partial class VolumeMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for volume. + internal VolumeMetadata(double value, VolumeUnit unit) + { + MetadataKind = MetadataKind.VolumeMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for volume. + internal VolumeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, VolumeUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal VolumeMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for volume. + public VolumeUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeUnit.cs new file mode 100644 index 000000000000..4aeb2e8dc24c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/VolumeUnit.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The Volume Unit of measurement. + public readonly partial struct VolumeUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VolumeUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string CubicMeterValue = "CubicMeter"; + private const string CubicCentimeterValue = "CubicCentimeter"; + private const string CubicMillimeterValue = "CubicMillimeter"; + private const string HectoliterValue = "Hectoliter"; + private const string DecaliterValue = "Decaliter"; + private const string LiterValue = "Liter"; + private const string CentiliterValue = "Centiliter"; + private const string MilliliterValue = "Milliliter"; + private const string CubicYardValue = "CubicYard"; + private const string CubicInchValue = "CubicInch"; + private const string CubicFootValue = "CubicFoot"; + private const string CubicMileValue = "CubicMile"; + private const string FluidOunceValue = "FluidOunce"; + private const string TeaspoonValue = "Teaspoon"; + private const string TablespoonValue = "Tablespoon"; + private const string PintValue = "Pint"; + private const string QuartValue = "Quart"; + private const string CupValue = "Cup"; + private const string GillValue = "Gill"; + private const string PinchValue = "Pinch"; + private const string FluidDramValue = "FluidDram"; + private const string BarrelValue = "Barrel"; + private const string MinimValue = "Minim"; + private const string CordValue = "Cord"; + private const string PeckValue = "Peck"; + private const string BushelValue = "Bushel"; + private const string HogsheadValue = "Hogshead"; + + /// Unspecified volume unit. + public static VolumeUnit Unspecified { get; } = new VolumeUnit(UnspecifiedValue); + /// Volume unit in cubic meters. + public static VolumeUnit CubicMeter { get; } = new VolumeUnit(CubicMeterValue); + /// Volume unit in cubic centimeters. + public static VolumeUnit CubicCentimeter { get; } = new VolumeUnit(CubicCentimeterValue); + /// Volume unit in cubic millimeters. + public static VolumeUnit CubicMillimeter { get; } = new VolumeUnit(CubicMillimeterValue); + /// Volume unit in hectoliters. + public static VolumeUnit Hectoliter { get; } = new VolumeUnit(HectoliterValue); + /// Volume unit in decaliters. + public static VolumeUnit Decaliter { get; } = new VolumeUnit(DecaliterValue); + /// Volume unit in liters. + public static VolumeUnit Liter { get; } = new VolumeUnit(LiterValue); + /// Volume unit in centiliters. + public static VolumeUnit Centiliter { get; } = new VolumeUnit(CentiliterValue); + /// Volume unit in milliliters. + public static VolumeUnit Milliliter { get; } = new VolumeUnit(MilliliterValue); + /// Volume unit in cubic yards. + public static VolumeUnit CubicYard { get; } = new VolumeUnit(CubicYardValue); + /// Volume unit in cubic inches. + public static VolumeUnit CubicInch { get; } = new VolumeUnit(CubicInchValue); + /// Volume unit in cubic feet. + public static VolumeUnit CubicFoot { get; } = new VolumeUnit(CubicFootValue); + /// Volume unit in cubic miles. + public static VolumeUnit CubicMile { get; } = new VolumeUnit(CubicMileValue); + /// Volume unit in fluid ounces. + public static VolumeUnit FluidOunce { get; } = new VolumeUnit(FluidOunceValue); + /// Volume unit in teaspoons. + public static VolumeUnit Teaspoon { get; } = new VolumeUnit(TeaspoonValue); + /// Volume unit in tablespoons. + public static VolumeUnit Tablespoon { get; } = new VolumeUnit(TablespoonValue); + /// Volume unit in pints. + public static VolumeUnit Pint { get; } = new VolumeUnit(PintValue); + /// Volume unit in quarts. + public static VolumeUnit Quart { get; } = new VolumeUnit(QuartValue); + /// Volume unit in cups. + public static VolumeUnit Cup { get; } = new VolumeUnit(CupValue); + /// Volume unit in gills. + public static VolumeUnit Gill { get; } = new VolumeUnit(GillValue); + /// Volume unit in pinches. + public static VolumeUnit Pinch { get; } = new VolumeUnit(PinchValue); + /// Volume unit in fluid drams. + public static VolumeUnit FluidDram { get; } = new VolumeUnit(FluidDramValue); + /// Volume unit in barrels. + public static VolumeUnit Barrel { get; } = new VolumeUnit(BarrelValue); + /// Volume unit in minims. + public static VolumeUnit Minim { get; } = new VolumeUnit(MinimValue); + /// Volume unit in cords. + public static VolumeUnit Cord { get; } = new VolumeUnit(CordValue); + /// Volume unit in pecks. + public static VolumeUnit Peck { get; } = new VolumeUnit(PeckValue); + /// Volume unit in bushels. + public static VolumeUnit Bushel { get; } = new VolumeUnit(BushelValue); + /// Volume unit in hogsheads. + public static VolumeUnit Hogshead { get; } = new VolumeUnit(HogsheadValue); + /// Determines if two values are the same. + public static bool operator ==(VolumeUnit left, VolumeUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VolumeUnit left, VolumeUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator VolumeUnit(string value) => new VolumeUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeUnit other && Equals(other); + /// + public bool Equals(VolumeUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WarningCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WarningCode.cs new file mode 100644 index 000000000000..2c148626c543 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WarningCode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// Defines the list of the warning codes. + public readonly partial struct WarningCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WarningCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LongWordsInDocumentValue = "LongWordsInDocument"; + private const string DocumentTruncatedValue = "DocumentTruncated"; + + /// Long words in document warning. + public static WarningCode LongWordsInDocument { get; } = new WarningCode(LongWordsInDocumentValue); + /// Document truncated warning. + public static WarningCode DocumentTruncated { get; } = new WarningCode(DocumentTruncatedValue); + /// Determines if two values are the same. + public static bool operator ==(WarningCode left, WarningCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WarningCode left, WarningCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator WarningCode(string value) => new WarningCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WarningCode other && Equals(other); + /// + public bool Equals(WarningCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightMetadata.Serialization.cs new file mode 100644 index 000000000000..b83336668a59 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + public partial class WeightMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeightMetadata)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + } + + WeightMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeightMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWeightMetadata(document.RootElement, options); + } + + internal static WeightMetadata DeserializeWeightMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + WeightUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new WeightUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WeightMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WeightMetadata)} does not support writing '{options.Format}' format."); + } + } + + WeightMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWeightMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WeightMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WeightMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightMetadata.cs new file mode 100644 index 000000000000..282c9f88707f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + /// Represents the Weight ) entity Metadata model. + public partial class WeightMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for weight. + internal WeightMetadata(double value, WeightUnit unit) + { + MetadataKind = MetadataKind.WeightMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for weight. + internal WeightMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, WeightUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal WeightMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for weight. + public WeightUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightUnit.cs new file mode 100644 index 000000000000..3197fa14b7c1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/WeightUnit.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text +{ + /// The weight Unit of measurement. + public readonly partial struct WeightUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WeightUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string KilogramValue = "Kilogram"; + private const string GramValue = "Gram"; + private const string MilligramValue = "Milligram"; + private const string GallonValue = "Gallon"; + private const string MetricTonValue = "MetricTon"; + private const string TonValue = "Ton"; + private const string PoundValue = "Pound"; + private const string OunceValue = "Ounce"; + private const string GrainValue = "Grain"; + private const string PennyWeightValue = "PennyWeight"; + private const string LongTonBritishValue = "LongTonBritish"; + private const string ShortTonUsValue = "ShortTonUS"; + private const string ShortHundredWeightUsValue = "ShortHundredWeightUS"; + private const string StoneValue = "Stone"; + private const string DramValue = "Dram"; + + /// Unspecified weight unit. + public static WeightUnit Unspecified { get; } = new WeightUnit(UnspecifiedValue); + /// Weight unit in kilograms. + public static WeightUnit Kilogram { get; } = new WeightUnit(KilogramValue); + /// Weight unit in grams. + public static WeightUnit Gram { get; } = new WeightUnit(GramValue); + /// Weight unit in milligrams. + public static WeightUnit Milligram { get; } = new WeightUnit(MilligramValue); + /// Volume unit in gallons. + public static WeightUnit Gallon { get; } = new WeightUnit(GallonValue); + /// Weight unit in metric tons. + public static WeightUnit MetricTon { get; } = new WeightUnit(MetricTonValue); + /// Weight unit in tons. + public static WeightUnit Ton { get; } = new WeightUnit(TonValue); + /// Weight unit in pounds. + public static WeightUnit Pound { get; } = new WeightUnit(PoundValue); + /// Weight unit in ounces. + public static WeightUnit Ounce { get; } = new WeightUnit(OunceValue); + /// Weight unit in grains. + public static WeightUnit Grain { get; } = new WeightUnit(GrainValue); + /// Weight unit in pennyweights. + public static WeightUnit PennyWeight { get; } = new WeightUnit(PennyWeightValue); + /// Weight unit in long tons (British). + public static WeightUnit LongTonBritish { get; } = new WeightUnit(LongTonBritishValue); + /// Weight unit in short tons (US). + public static WeightUnit ShortTonUs { get; } = new WeightUnit(ShortTonUsValue); + /// Weight unit in short hundredweights (US). + public static WeightUnit ShortHundredWeightUs { get; } = new WeightUnit(ShortHundredWeightUsValue); + /// Weight unit in stones. + public static WeightUnit Stone { get; } = new WeightUnit(StoneValue); + /// Weight unit in drams. + public static WeightUnit Dram { get; } = new WeightUnit(DramValue); + /// Determines if two values are the same. + public static bool operator ==(WeightUnit left, WeightUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WeightUnit left, WeightUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator WeightUnit(string value) => new WeightUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WeightUnit other && Equals(other); + /// + public bool Equals(WeightUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..5898c43ced6b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.AI.Language.Text.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj new file mode 100644 index 000000000000..332b4c607ae0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs new file mode 100644 index 000000000000..710acbfa64e1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs @@ -0,0 +1,3369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Language.Text.Samples +{ + public partial class Samples_TextAnalysisClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulDynamicClassificationRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "DynamicClassification", + parameters = new + { + categories = new object[] + { +"Health", +"Politics", +"Music", +"Sports" + }, + classificationType = "Multi", + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "The WHO is issuing a warning about Monkey Pox.", +}, +new +{ +id = "2", +language = "en", +text = "Mo Salah plays in Liverpool FC in England.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulDynamicClassificationRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "DynamicClassification", + parameters = new + { + categories = new object[] + { +"Health", +"Politics", +"Music", +"Sports" + }, + classificationType = "Multi", + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "The WHO is issuing a warning about Monkey Pox.", +}, +new +{ +id = "2", +language = "en", +text = "Mo Salah plays in Liverpool FC in England.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulDynamicClassificationRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "The WHO is issuing a warning about Monkey Pox.") +{ +Language = "en", +}, new MultiLanguageInput("2", "Mo Salah plays in Liverpool FC in England.") +{ +Language = "en", +}}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "Health", "Politics", "Music", "Sports" }) + { + ModelVersion = "latest", + ClassificationType = ClassificationType.Multi, + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulDynamicClassificationRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "The WHO is issuing a warning about Monkey Pox.") +{ +Language = "en", +}, new MultiLanguageInput("2", "Mo Salah plays in Liverpool FC in England.") +{ +Language = "en", +}}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "Health", "Politics", "Music", "Sports" }) + { + ModelVersion = "latest", + ClassificationType = ClassificationType.Multi, + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityLinkingRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityLinking", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "Microsoft was founded by Bill Gates and Paul Allen.", +}, +new +{ +id = "2", +language = "en", +text = "Pike place market is my favorite Seattle attraction.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityLinkingRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityLinking", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "Microsoft was founded by Bill Gates and Paul Allen.", +}, +new +{ +id = "2", +language = "en", +text = "Pike place market is my favorite Seattle attraction.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityLinkingRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityLinkingInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") +{ +Language = "en", +}, new MultiLanguageInput("2", "Pike place market is my favorite Seattle attraction.") +{ +Language = "en", +}}, + }, + ActionContent = new EntityLinkingActionContent + { + ModelVersion = "latest", + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityLinkingRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityLinkingInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") +{ +Language = "en", +}, new MultiLanguageInput("2", "Pike place market is my favorite Seattle attraction.") +{ +Language = "en", +}}, + }, + ActionContent = new EntityLinkingActionContent + { + ModelVersion = "latest", + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionExclusionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + exclusionList = new object[] + { +"Numeric" + }, + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "2", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +}, +new +{ +id = "3", +language = "en", +text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionExclusionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + exclusionList = new object[] + { +"Numeric" + }, + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "2", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +}, +new +{ +id = "3", +language = "en", +text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionExclusionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Exclusions = { EntityCategory.Numeric }, + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionExclusionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Exclusions = { EntityCategory.Numeric }, + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionInclusionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inclusionList = new object[] + { +"Location" + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "2", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +}, +new +{ +id = "3", +language = "en", +text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionInclusionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inclusionList = new object[] + { +"Location" + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "2", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +}, +new +{ +id = "3", +language = "en", +text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionInclusionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Inclusions = { EntityCategory.Location }, + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionInclusionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + Inclusions = { EntityCategory.Location }, + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionInferenceOptionsRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inferenceOptions = new + { + excludeNormalizedValues = true, + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionInferenceOptionsRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + inferenceOptions = new + { + excludeNormalizedValues = true, + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionInferenceOptionsRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + InferenceOptions = new EntityInferenceConfig + { + ExcludeNormalizedValues = true, + }, + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionInferenceOptionsRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + InferenceOptions = new EntityInferenceConfig + { + ExcludeNormalizedValues = true, + }, + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionOverlapPolicy() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "matchLongest", + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "4", +language = "en", +text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionOverlapPolicy_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "matchLongest", + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "4", +language = "en", +text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionOverlapPolicy_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new MatchLongestEntityPolicyType(), + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionOverlapPolicy_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new MatchLongestEntityPolicyType(), + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "2", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +}, +new +{ +id = "3", +language = "en", +text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", +}, +new +{ +id = "4", +language = "en", +text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", +}, +new +{ +id = "5", +language = "en", +text = "My IP is 127.12.1.1 and my phone number is 5555555555", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "EntityRecognition", + parameters = new + { + modelVersion = "latest", + overlapPolicy = new + { + policyKind = "allowOverlap", + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "2", +language = "en", +text = "When I was 5 years old I had $90.00 dollars to my name.", +}, +new +{ +id = "3", +language = "en", +text = "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.", +}, +new +{ +id = "4", +language = "en", +text = "25th April Meeting was an intresting one. At least we gont to experience the WorldCup", +}, +new +{ +id = "5", +language = "en", +text = "My IP is 127.12.1.1 and my phone number is 5555555555", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulEntityRecognitionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") +{ +Language = "en", +}, new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") +{ +Language = "en", +}, new MultiLanguageInput("5", "My IP is 127.12.1.1 and my phone number is 5555555555") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulEntityRecognitionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextEntityRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("2", "When I was 5 years old I had $90.00 dollars to my name.") +{ +Language = "en", +}, new MultiLanguageInput("3", "When we flew from LAX it seemed like we were moving at 10 meters per second. I was lucky to see Amsterdam, Effile Tower, and the Nile.") +{ +Language = "en", +}, new MultiLanguageInput("4", "25th April Meeting was an intresting one. At least we gont to experience the WorldCup") +{ +Language = "en", +}, new MultiLanguageInput("5", "My IP is 127.12.1.1 and my phone number is 5555555555") +{ +Language = "en", +}}, + }, + ActionContent = new EntitiesActionContent + { + ModelVersion = "latest", + OverlapPolicy = new AllowOverlapEntityPolicyType(), + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulKeyPhraseExtractionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "KeyPhraseExtraction", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "Microsoft was founded by Bill Gates and Paul Allen.", +}, +new +{ +id = "2", +language = "en", +text = "Text Analytics is one of the Azure Cognitive Services.", +}, +new +{ +id = "3", +language = "en", +text = "My cat might need to see a veterinarian.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulKeyPhraseExtractionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "KeyPhraseExtraction", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "Microsoft was founded by Bill Gates and Paul Allen.", +}, +new +{ +id = "2", +language = "en", +text = "Text Analytics is one of the Azure Cognitive Services.", +}, +new +{ +id = "3", +language = "en", +text = "My cat might need to see a veterinarian.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulKeyPhraseExtractionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextKeyPhraseExtractionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") +{ +Language = "en", +}, new MultiLanguageInput("2", "Text Analytics is one of the Azure Cognitive Services.") +{ +Language = "en", +}, new MultiLanguageInput("3", "My cat might need to see a veterinarian.") +{ +Language = "en", +}}, + }, + ActionContent = new KeyPhraseActionContent + { + ModelVersion = "latest", + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulKeyPhraseExtractionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextKeyPhraseExtractionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Microsoft was founded by Bill Gates and Paul Allen.") +{ +Language = "en", +}, new MultiLanguageInput("2", "Text Analytics is one of the Azure Cognitive Services.") +{ +Language = "en", +}, new MultiLanguageInput("3", "My cat might need to see a veterinarian.") +{ +Language = "en", +}}, + }, + ActionContent = new KeyPhraseActionContent + { + ModelVersion = "latest", + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulLanguageDetectionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "LanguageDetection", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +text = "Hello world", +}, +new +{ +id = "2", +text = "Bonjour tout le monde", +}, +new +{ +id = "3", +text = "Hola mundo", +}, +new +{ +id = "4", +text = "Tumhara naam kya hai?", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulLanguageDetectionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "LanguageDetection", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +text = "Hello world", +}, +new +{ +id = "2", +text = "Bonjour tout le monde", +}, +new +{ +id = "3", +text = "Hola mundo", +}, +new +{ +id = "4", +text = "Tumhara naam kya hai?", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulLanguageDetectionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextLanguageDetectionInput + { + TextInput = new LanguageDetectionTextInput + { + LanguageInputs = { new LanguageInput("1", "Hello world"), new LanguageInput("2", "Bonjour tout le monde"), new LanguageInput("3", "Hola mundo"), new LanguageInput("4", "Tumhara naam kya hai?") }, + }, + ActionContent = new LanguageDetectionActionContent + { + ModelVersion = "latest", + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulLanguageDetectionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextLanguageDetectionInput + { + TextInput = new LanguageDetectionTextInput + { + LanguageInputs = { new LanguageInput("1", "Hello world"), new LanguageInput("2", "Bonjour tout le monde"), new LanguageInput("3", "Hola mundo"), new LanguageInput("4", "Tumhara naam kya hai?") }, + }, + ActionContent = new LanguageDetectionActionContent + { + ModelVersion = "latest", + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionExclusionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + excludePiiCategories = new object[] + { +"USSocialSecurityNumber" + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "My SSN is 859-98-0987", +}, +new +{ +id = "2", +language = "en", +text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", +}, +new +{ +id = "3", +language = "en", +text = "Is 998.214.865-68 your Brazilian CPF number?", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionExclusionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + excludePiiCategories = new object[] + { +"USSocialSecurityNumber" + }, + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "My SSN is 859-98-0987", +}, +new +{ +id = "2", +language = "en", +text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", +}, +new +{ +id = "3", +language = "en", +text = "Is 998.214.865-68 your Brazilian CPF number?", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionExclusionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") +{ +Language = "en", +}, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") +{ +Language = "en", +}, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") +{ +Language = "en", +}}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + ExcludePiiCategories = { PiiCategoriesExclude.UsSocialSecurityNumber }, + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionExclusionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") +{ +Language = "en", +}, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") +{ +Language = "en", +}, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") +{ +Language = "en", +}}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + ExcludePiiCategories = { PiiCategoriesExclude.UsSocialSecurityNumber }, + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRedactionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + redactionCharacter = "-", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "My SSN is 859-98-0987", +}, +new +{ +id = "2", +language = "en", +text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", +}, +new +{ +id = "3", +language = "en", +text = "Is 998.214.865-68 your Brazilian CPF number?", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRedactionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + redactionCharacter = "-", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "My SSN is 859-98-0987", +}, +new +{ +id = "2", +language = "en", +text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", +}, +new +{ +id = "3", +language = "en", +text = "Is 998.214.865-68 your Brazilian CPF number?", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRedactionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") +{ +Language = "en", +}, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") +{ +Language = "en", +}, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") +{ +Language = "en", +}}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + RedactionCharacter = RedactionCharacter.Minus, + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRedactionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") +{ +Language = "en", +}, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") +{ +Language = "en", +}, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") +{ +Language = "en", +}}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + RedactionCharacter = RedactionCharacter.Minus, + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "My SSN is 859-98-0987", +}, +new +{ +id = "2", +language = "en", +text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", +}, +new +{ +id = "3", +language = "en", +text = "Is 998.214.865-68 your Brazilian CPF number?", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "PiiEntityRecognition", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "My SSN is 859-98-0987", +}, +new +{ +id = "2", +language = "en", +text = "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.", +}, +new +{ +id = "3", +language = "en", +text = "Is 998.214.865-68 your Brazilian CPF number?", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") +{ +Language = "en", +}, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") +{ +Language = "en", +}, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") +{ +Language = "en", +}}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulPiiEntityRecognitionRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextPiiEntitiesRecognitionInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "My SSN is 859-98-0987") +{ +Language = "en", +}, new MultiLanguageInput("2", "Your ABA number - 111000025 - is the first 9 digits in the lower left hand corner of your personal check.") +{ +Language = "en", +}, new MultiLanguageInput("3", "Is 998.214.865-68 your Brazilian CPF number?") +{ +Language = "en", +}}, + }, + ActionContent = new PiiActionContent + { + ModelVersion = "latest", + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulSentimentAnalysisRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "SentimentAnalysis", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.", +} + }, + }, + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulSentimentAnalysisRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "SentimentAnalysis", + parameters = new + { + modelVersion = "latest", + }, + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.", +} + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_SuccessfulSentimentAnalysisRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextSentimentAnalysisInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.") +{ +Language = "en", +}}, + }, + ActionContent = new SentimentAnalysisActionContent + { + ModelVersion = "latest", + }, + }; + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_SuccessfulSentimentAnalysisRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextSentimentAnalysisInput + { + TextInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Great atmosphere. Close to plenty of restaurants, hotels, and transit! Staff are friendly and helpful.") +{ +Language = "en", +}}, + }, + ActionContent = new SentimentAnalysisActionContent + { + ModelVersion = "latest", + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAbstractiveSummarizationTaskResult() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAbstractiveSummarizationTaskResult_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAbstractiveSummarizationTaskResult_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAbstractiveSummarizationTaskResult_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAnalyzeTextJobsMultipleTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAnalyzeTextJobsMultipleTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAnalyzeTextJobsMultipleTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulAnalyzeTextJobsMultipleTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomAbstractiveSummarizationTaskResult() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomAbstractiveSummarizationTaskResult_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomAbstractiveSummarizationTaskResult_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomAbstractiveSummarizationTaskResult_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomHealthcareTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomHealthcareTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomHealthcareTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomHealthcareTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomSentimentAnalysisTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomSentimentAnalysisTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomSentimentAnalysisTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulCustomSentimentAnalysisTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("29fe5bb0-83ae-4f86-85d6-775534dcd2d4")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareDocumentTypeTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareDocumentTypeTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareDocumentTypeTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareDocumentTypeTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("15e4a46b-62e2-4386-8d36-9c2a92bb45dd")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_SuccessfulHealthcareTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("1780194a-e9c1-4298-b0d4-fdc59ba818a0")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulAbstractiveSummarizationTaskSubmit() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Document Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "AbstractiveSummarization", +taskName = "Document Abstractive Summarization Task 1", +parameters = new +{ +sentenceCount = 1, +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulAbstractiveSummarizationTaskSubmit_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Document Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "AbstractiveSummarization", +taskName = "Document Abstractive Summarization Task 1", +parameters = new +{ +sentenceCount = 1, +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulAbstractiveSummarizationTaskSubmit_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new AbstractiveSummarizationOperationAction +{ +ActionContent = new AbstractiveSummarizationActionContent +{ +SentenceCount = 1, +}, +Name = "Document Abstractive Summarization Task 1", +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulAbstractiveSummarizationTaskSubmit_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new AbstractiveSummarizationOperationAction +{ +ActionContent = new AbstractiveSummarizationActionContent +{ +SentenceCount = 1, +}, +Name = "Document Abstractive Summarization Task 1", +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulAnalyzeTextJobsMultipleTaskSubmitRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Extracting Location & US Region", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "I had a wonderful trip to Seattle last week.", +}, +new +{ +id = "2", +language = "en", +text = "I'm flying to NYC tomorrow. See you there.", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "EntityRecognition", +taskName = "Recognize Entities", +parameters = new +{ +modelVersion = "latest", +}, +}, +new +{ +kind = "CustomEntityRecognition", +taskName = "Recognize US Regions", +parameters = new +{ +projectName = "MyProject", +deploymentName = "MyDeployment", +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulAnalyzeTextJobsMultipleTaskSubmitRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Extracting Location & US Region", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "I had a wonderful trip to Seattle last week.", +}, +new +{ +id = "2", +language = "en", +text = "I'm flying to NYC tomorrow. See you there.", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "EntityRecognition", +taskName = "Recognize Entities", +parameters = new +{ +modelVersion = "latest", +}, +}, +new +{ +kind = "CustomEntityRecognition", +taskName = "Recognize US Regions", +parameters = new +{ +projectName = "MyProject", +deploymentName = "MyDeployment", +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulAnalyzeTextJobsMultipleTaskSubmitRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "I had a wonderful trip to Seattle last week.") +{ +Language = "en", +}, new MultiLanguageInput("2", "I'm flying to NYC tomorrow. See you there.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new EntitiesOperationAction +{ +ActionContent = new EntitiesActionContent +{ +ModelVersion = "latest", +}, +Name = "Recognize Entities", +}, +new CustomEntitiesOperationAction +{ +ActionContent = new CustomEntitiesActionContent("MyProject", "MyDeployment"), +Name = "Recognize US Regions", +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulAnalyzeTextJobsMultipleTaskSubmitRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "I had a wonderful trip to Seattle last week.") +{ +Language = "en", +}, new MultiLanguageInput("2", "I'm flying to NYC tomorrow. See you there.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new EntitiesOperationAction +{ +ActionContent = new EntitiesActionContent +{ +ModelVersion = "latest", +}, +Name = "Recognize Entities", +}, +new CustomEntitiesOperationAction +{ +ActionContent = new CustomEntitiesActionContent("MyProject", "MyDeployment"), +Name = "Recognize US Regions", +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomAbstractiveSummarizationTaskSubmit() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Document Custom Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomAbstractiveSummarization", +taskName = "Custom Document Abstractive Summarization Task 1", +parameters = new +{ +projectName = "my_project", +deploymentName = "my_deployment", +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomAbstractiveSummarizationTaskSubmit_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Document Custom Abstractive Summarization Task Example", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +text = "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomAbstractiveSummarization", +taskName = "Custom Document Abstractive Summarization Task 1", +parameters = new +{ +projectName = "my_project", +deploymentName = "my_deployment", +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomAbstractiveSummarizationTaskSubmit_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomAbstractiveSummarizationOperationAction(new CustomAbstractiveSummarizationActionContent("my_project", "my_deployment")) +{ +Name = "Custom Document Abstractive Summarization Task 1", +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomAbstractiveSummarizationTaskSubmit_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "At Microsoft, we have been on a quest to advance AI beyond existing techniques, by taking a more holistic, human-centric approach to learning and understanding. As Chief Technology Officer of Azure AI Cognitive Services, I have been working with a team of amazing scientists and engineers to turn this quest into a reality. In my role, I enjoy a unique perspective in viewing the relationship among three attributes of human cognition: monolingual text (X), audio or visual sensory signals, (Y) and multilingual (Z). At the intersection of all three, there is magic—what we call XYZ-code as illustrated in Figure 1—a joint representation to create more powerful AI that can speak, hear, see, and understand humans better. We believe XYZ-code will enable us to fulfill our long-term vision: cross-domain transfer learning, spanning modalities and languages. The goal is to have pre-trained models that can jointly learn representations to support a broad range of downstream AI tasks, much in the way humans do today. Over the past five years, we have achieved human performance on benchmarks in conversational speech recognition, machine translation, conversational question answering, machine reading comprehension, and image captioning. These five breakthroughs provided us with strong signals toward our more ambitious aspiration to produce a leap in AI capabilities, achieving multi-sensory and multilingual learning that is closer in line with how humans learn and understand. I believe the joint XYZ-code is a foundational component of this aspiration, if grounded with external knowledge sources in the downstream AI tasks.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomAbstractiveSummarizationOperationAction(new CustomAbstractiveSummarizationActionContent("my_project", "my_deployment")) +{ +Name = "Custom Document Abstractive Summarization Task 1", +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomHealthcarePostRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "Prescribed 100mg ibuprofen, taken twice daily.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomHealthcare", +parameters = new +{ +projectName = "{PROJECT-NAME}", +deploymentName = "{DEPLOYMENT-NAME}", +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomHealthcarePostRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "Prescribed 100mg ibuprofen, taken twice daily.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomHealthcare", +parameters = new +{ +projectName = "{PROJECT-NAME}", +deploymentName = "{DEPLOYMENT-NAME}", +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomHealthcarePostRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomHealthcareOperationAction +{ +ActionContent = new CustomHealthcareActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomHealthcarePostRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomHealthcareOperationAction +{ +ActionContent = new CustomHealthcareActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomSentimentAnalysisTaskSubmit() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "The food is great. But the service is bad.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomSentimentAnalysis", +parameters = new +{ +projectName = "{PROJECT-NAME}", +deploymentName = "{DEPLOYMENT-NAME}", +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomSentimentAnalysisTaskSubmit_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "The food is great. But the service is bad.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomSentimentAnalysis", +parameters = new +{ +projectName = "{PROJECT-NAME}", +deploymentName = "{DEPLOYMENT-NAME}", +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomSentimentAnalysisTaskSubmit_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "The food is great. But the service is bad.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomSentimentAnalysisOperationAction +{ +ActionContent = new CustomSentimentAnalysisActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulCustomSentimentAnalysisTaskSubmit_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "The food is great. But the service is bad.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomSentimentAnalysisOperationAction +{ +ActionContent = new CustomSentimentAnalysisActionContent("{PROJECT-NAME}", "{DEPLOYMENT-NAME}"), +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcareDocumentTypePostRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "Prescribed 100mg ibuprofen, taken twice daily.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "Healthcare", +parameters = new +{ +modelVersion = "latest", +fhirVersion = "4.0.1", +documentType = "DischargeSummary", +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcareDocumentTypePostRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "Prescribed 100mg ibuprofen, taken twice daily.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "Healthcare", +parameters = new +{ +modelVersion = "latest", +fhirVersion = "4.0.1", +documentType = "DischargeSummary", +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcareDocumentTypePostRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new HealthcareOperationAction +{ +ActionContent = new HealthcareActionContent +{ +ModelVersion = "latest", +FhirVersion = FhirVersion._401, +DocumentType = HealthcareDocumentType.DischargeSummary, +}, +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcareDocumentTypePostRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new HealthcareOperationAction +{ +ActionContent = new HealthcareActionContent +{ +ModelVersion = "latest", +FhirVersion = FhirVersion._401, +DocumentType = HealthcareDocumentType.DischargeSummary, +}, +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcarePostRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "Prescribed 100mg ibuprofen, taken twice daily.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "Healthcare", +parameters = new +{ +modelVersion = "latest", +}, +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcarePostRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new + { + documents = new object[] + { +new +{ +text = "Prescribed 100mg ibuprofen, taken twice daily.", +id = "1", +language = "en", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "Healthcare", +parameters = new +{ +modelVersion = "latest", +}, +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcarePostRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") +{ +Language = "en", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new HealthcareOperationAction +{ +ActionContent = new HealthcareActionContent +{ +ModelVersion = "latest", +}, +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_SuccessfulHealthcarePostRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + MultiLanguageInputs = {new MultiLanguageInput("1", "Prescribed 100mg ibuprofen, taken twice daily.") +{ +Language = "en", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new HealthcareOperationAction +{ +ActionContent = new HealthcareActionContent +{ +ModelVersion = "latest", +}, +} + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextCancelOperation_SuccessfulAnalyzeTextJobsCancelRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Operation operation = client.AnalyzeTextCancelOperation(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextCancelOperation_SuccessfulAnalyzeTextJobsCancelRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Operation operation = await client.AnalyzeTextCancelOperationAsync(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml new file mode 100644 index 000000000000..c937eea56c3e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/cognitiveservices/Language.AnalyzeText +commit: 350d513936efe05d41975a4a82de11314dc7136f +repo: Azure/azure-rest-api-specs +additionalDirectories: