diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/Azure.AI.Language.Documents.sln b/sdk/cognitivelanguage/Azure.AI.Language.Documents/Azure.AI.Language.Documents.sln new file mode 100644 index 000000000000..a513ce035af2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/Azure.AI.Language.Documents.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.Documents", "src\Azure.AI.Language.Documents.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Language.Documents.Tests", "tests\Azure.AI.Language.Documents.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/cognitivelanguage/Azure.AI.Language.Documents/CHANGELOG.md b/sdk/cognitivelanguage/Azure.AI.Language.Documents/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/Directory.Build.props b/sdk/cognitivelanguage/Azure.AI.Language.Documents/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/README.md b/sdk/cognitivelanguage/Azure.AI.Language.Documents/README.md new file mode 100644 index 000000000000..f54d319a2690 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/README.md @@ -0,0 +1,107 @@ +# Azure.AI.Language.Documents client library for .NET + +Azure.AI.Language.Documents 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/cognitivelanguage/Azure.AI.Language.Documents/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.Documents --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/cognitivelanguage/Azure.AI.Language.Documents/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/cognitivelanguage/Azure.AI.Language.Documents/README.png) \ No newline at end of file diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.net8.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.net8.0.cs new file mode 100644 index 000000000000..bcad6a623e6b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.net8.0.cs @@ -0,0 +1,1031 @@ +namespace Azure.AI.Language.Documents +{ + public partial class AbstractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationActionContent() { } + public string Instruction { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public int? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Documents.StringIndexType? StringIndexType { get { throw null; } set { } } + public Azure.AI.Language.Documents.SummaryLengthBucket? SummaryLength { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationOperationAction(Azure.AI.Language.Documents.AbstractiveSummarizationActionContent actionContent) { } + public Azure.AI.Language.Documents.AbstractiveSummarizationActionContent ActionContent { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsLROResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Documents.DocumentActionState)) { } + public Azure.AI.Language.Documents.AnalyzeDocumentsResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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 static partial class AILanguageDocumentsModelFactory + { + public static Azure.AI.Language.Documents.AbstractiveSummarizationOperationAction AbstractiveSummarizationOperationAction(string name = null, Azure.AI.Language.Documents.AbstractiveSummarizationActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Documents.AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, Azure.AI.Language.Documents.AnalyzeDocumentsResult results = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsDocumentError AnalyzeDocumentsDocumentError(string id = null, Azure.AI.Language.Documents.AnalyzeDocumentsError error = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsError AnalyzeDocumentsError(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode code = default(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Documents.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsJobState AnalyzeDocumentsJobState(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.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), System.Collections.Generic.IEnumerable errors = null, string nextLink = null, Azure.AI.Language.Documents.DocumentActions tasks = null, Azure.AI.Language.Documents.RequestStatistics statistics = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsLROResult AnalyzeDocumentsLROResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, string kind = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput AnalyzeDocumentsOperationInput(string displayName = null, Azure.AI.Language.Documents.MultiLanguageDocumentInput documentsInput = null, System.Collections.Generic.IEnumerable actions = null, string defaultLanguage = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsResult AnalyzeDocumentsResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Documents.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Documents.DocumentActions DocumentActions(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.Documents.DocumentAnalysisDocumentResult DocumentAnalysisDocumentResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Documents.DocumentStatistics statistics = null, Azure.AI.Language.Documents.DocumentLocation source = null, System.Collections.Generic.IEnumerable target = null) { throw null; } + public static Azure.AI.Language.Documents.DocumentStatistics DocumentStatistics(int charactersCount = 0, int transactionsCount = 0) { throw null; } + public static Azure.AI.Language.Documents.DocumentWarning DocumentWarning(Azure.AI.Language.Documents.WarningCode code = default(Azure.AI.Language.Documents.WarningCode), string message = null, string targetRef = null) { throw null; } + public static Azure.AI.Language.Documents.ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, Azure.AI.Language.Documents.AnalyzeDocumentsResult results = null) { throw null; } + public static Azure.AI.Language.Documents.InnerErrorModel InnerErrorModel(Azure.AI.Language.Documents.InnerErrorCode code = default(Azure.AI.Language.Documents.InnerErrorCode), string message = null, System.Collections.Generic.IReadOnlyDictionary details = null, string target = null, Azure.AI.Language.Documents.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Documents.MultiLanguageInput MultiLanguageInput(string id = null, Azure.AI.Language.Documents.DocumentLocation source = null, Azure.AI.Language.Documents.DocumentLocation target = null, string language = null) { throw null; } + public static Azure.AI.Language.Documents.PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, Azure.AI.Language.Documents.AnalyzeDocumentsResult results = null) { throw null; } + public static Azure.AI.Language.Documents.RequestStatistics RequestStatistics(int documentsCount = 0, int validDocumentsCount = 0, int erroneousDocumentsCount = 0, long transactionsCount = (long)0) { throw null; } + } + public partial class AnalyzeDocumentsClient + { + protected AnalyzeDocumentsClient() { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions options) { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation AnalyzeDocumentsCancelOperation(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeDocumentsCancelOperationAsync(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation AnalyzeDocumentsSubmitOperation(Azure.WaitUntil waitUntil, Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput analyzeDocumentOperationInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation AnalyzeDocumentsSubmitOperation(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeDocumentsSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput analyzeDocumentOperationInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeDocumentsSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetAnalyzeDocumentsJobStatus(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetAnalyzeDocumentsJobStatus(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 GetAnalyzeDocumentsJobStatusAsync(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetAnalyzeDocumentsJobStatusAsync(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 partial class AnalyzeDocumentsClientOptions : Azure.Core.ClientOptions + { + public AnalyzeDocumentsClientOptions(Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions.ServiceVersion version = Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions.ServiceVersion.V2024_11_15_Preview) { } + public enum ServiceVersion + { + V2024_11_15_Preview = 1, + } + } + public partial class AnalyzeDocumentsDocumentError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsDocumentError() { } + public Azure.AI.Language.Documents.AnalyzeDocumentsError 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.Documents.AnalyzeDocumentsDocumentError 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.Documents.AnalyzeDocumentsDocumentError 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 AnalyzeDocumentsError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsError() { } + public Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Details { get { throw null; } } + public Azure.AI.Language.Documents.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.Documents.AnalyzeDocumentsError 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.Documents.AnalyzeDocumentsError 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 AnalyzeDocumentsErrorCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AnalyzeDocumentsErrorCode(string value) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchIndexLimitReached { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchIndexNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Conflict { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Forbidden { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode InternalServerError { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode InvalidArgument { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode NotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode OperationNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode ProjectNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode QuotaExceeded { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode ServiceUnavailable { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Timeout { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode TooManyRequests { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Unauthorized { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Warning { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode 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.Documents.AnalyzeDocumentsErrorCode left, Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode left, Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AnalyzeDocumentsJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsJobState() { } + 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.Documents.RequestStatistics Statistics { get { throw null; } } + public Azure.AI.Language.Documents.DocumentActionState Status { get { throw null; } } + public Azure.AI.Language.Documents.DocumentActions Tasks { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsJobState 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.Documents.AnalyzeDocumentsJobState 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 AnalyzeDocumentsLROResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeDocumentsLROResult(System.DateTimeOffset lastUpdateDateTime, Azure.AI.Language.Documents.DocumentActionState status) { } + public System.DateTimeOffset LastUpdateDateTime { get { throw null; } } + public Azure.AI.Language.Documents.DocumentActionState Status { get { throw null; } } + public string TaskName { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsLROResult 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.Documents.AnalyzeDocumentsLROResult 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 AnalyzeDocumentsOperationAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeDocumentsOperationAction() { } + public string Name { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsOperationAction 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.Documents.AnalyzeDocumentsOperationAction 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 AnalyzeDocumentsOperationInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AnalyzeDocumentsOperationInput(Azure.AI.Language.Documents.MultiLanguageDocumentInput documentsInput, System.Collections.Generic.IEnumerable actions) { } + public System.Collections.Generic.IList Actions { get { throw null; } } + public string DefaultLanguage { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.AI.Language.Documents.MultiLanguageDocumentInput DocumentsInput { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput 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.Documents.AnalyzeDocumentsOperationInput 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 AnalyzeDocumentsResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsResult() { } + 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.Documents.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsResult 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.Documents.AnalyzeDocumentsResult 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 AzureBlobDocumentLocation : Azure.AI.Language.Documents.DocumentLocation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureBlobDocumentLocation(string location) { } + public string Location { get { throw null; } set { } } + public string ManagedIdentityClientId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AzureBlobDocumentLocation 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.Documents.AzureBlobDocumentLocation 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 BaseRedactionPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected BaseRedactionPolicy() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.BaseRedactionPolicy 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.Documents.BaseRedactionPolicy 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 CharacterMaskPolicy : Azure.AI.Language.Documents.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CharacterMaskPolicy() { } + public Azure.AI.Language.Documents.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.CharacterMaskPolicy 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.Documents.CharacterMaskPolicy 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 DocumentActions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentActions() { } + 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.Documents.DocumentActions 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.Documents.DocumentActions 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 DocumentActionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DocumentActionState(string value) { throw null; } + public static Azure.AI.Language.Documents.DocumentActionState Cancelled { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Cancelling { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Failed { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState NotStarted { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState PartiallyCompleted { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Running { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.DocumentActionState 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.Documents.DocumentActionState left, Azure.AI.Language.Documents.DocumentActionState right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.DocumentActionState (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.DocumentActionState left, Azure.AI.Language.Documents.DocumentActionState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DocumentAnalysisDocumentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentAnalysisDocumentResult() { } + public string Id { get { throw null; } } + public Azure.AI.Language.Documents.DocumentLocation Source { get { throw null; } } + public Azure.AI.Language.Documents.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Target { 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.Documents.DocumentAnalysisDocumentResult 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.Documents.DocumentAnalysisDocumentResult 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 DocumentLocation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DocumentLocation() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.DocumentLocation 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.Documents.DocumentLocation 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 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.Documents.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.Documents.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.Documents.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.Documents.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.Documents.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 EntityMaskPolicy : Azure.AI.Language.Documents.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityMaskPolicy() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.EntityMaskPolicy 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.Documents.EntityMaskPolicy 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.Documents.ExtractiveSummarizationSortingCriteria? SortBy { get { throw null; } set { } } + public Azure.AI.Language.Documents.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExtractiveSummarizationOperationAction() { } + public Azure.AI.Language.Documents.ExtractiveSummarizationActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsLROResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Documents.DocumentActionState)) { } + public Azure.AI.Language.Documents.AnalyzeDocumentsResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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; } + } + [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.Documents.ExtractiveSummarizationSortingCriteria Offset { get { throw null; } } + public static Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria Rank { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria 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.Documents.InnerErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode EmptyRequest { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode ExtractionFailure { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidCountryHint { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidDocument { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidDocumentBatch { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidParameterValue { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidRequestBodyFormat { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode KnowledgeBaseNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode MissingInputDocuments { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode ModelVersionIncorrect { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode UnsupportedLanguageCode { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.InnerErrorCode left, Azure.AI.Language.Documents.InnerErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.InnerErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.InnerErrorCode left, Azure.AI.Language.Documents.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.Documents.InnerErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Details { get { throw null; } } + public Azure.AI.Language.Documents.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.Documents.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.Documents.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 MultiLanguageDocumentInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MultiLanguageDocumentInput() { } + public System.Collections.Generic.IList Documents { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.MultiLanguageDocumentInput 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.Documents.MultiLanguageDocumentInput 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, Azure.AI.Language.Documents.DocumentLocation source, Azure.AI.Language.Documents.DocumentLocation target) { } + public string Id { get { throw null; } } + public string Language { get { throw null; } set { } } + public Azure.AI.Language.Documents.DocumentLocation Source { get { throw null; } } + public Azure.AI.Language.Documents.DocumentLocation Target { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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 NoMaskPolicy : Azure.AI.Language.Documents.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NoMaskPolicy() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.NoMaskPolicy 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.Documents.NoMaskPolicy 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.Documents.PiiDomain? Domain { get { throw null; } set { } } + public bool? ExcludeExtractionData { 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.Documents.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } + public Azure.AI.Language.Documents.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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; } + } + [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.Documents.PiiCategoriesExclude AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Address { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Age { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureSas { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Date { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Email { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EsDni { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IPAddress { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Organization { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Person { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SaNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SeNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SwiftCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TwNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude URL { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.PiiCategoriesExclude left, Azure.AI.Language.Documents.PiiCategoriesExclude right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.PiiCategoriesExclude (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.PiiCategoriesExclude left, Azure.AI.Language.Documents.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.Documents.PiiCategory AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Address { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Age { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory All { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureSas { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Date { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Default { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Email { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EsDni { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IPAddress { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Organization { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Person { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SaNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SeNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SwiftCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TwNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory URL { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.PiiCategory left, Azure.AI.Language.Documents.PiiCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.PiiCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.PiiCategory left, Azure.AI.Language.Documents.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.Documents.PiiDomain None { get { throw null; } } + public static Azure.AI.Language.Documents.PiiDomain Phi { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.PiiDomain left, Azure.AI.Language.Documents.PiiDomain right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.PiiDomain (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.PiiDomain left, Azure.AI.Language.Documents.PiiDomain right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PiiEntityRecognitionOperationResult : Azure.AI.Language.Documents.AnalyzeDocumentsLROResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiEntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Documents.DocumentActionState)) { } + public Azure.AI.Language.Documents.AnalyzeDocumentsResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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 PiiLROTask : Azure.AI.Language.Documents.AnalyzeDocumentsOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiLROTask() { } + public Azure.AI.Language.Documents.PiiActionContent Parameters { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.PiiLROTask 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.Documents.PiiLROTask 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 RedactionCharacter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedactionCharacter(string value) { throw null; } + public static Azure.AI.Language.Documents.RedactionCharacter Ampersand { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Asterisk { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter AtSign { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Caret { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Dollar { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter EqualsValue { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter ExclamationPoint { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Minus { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter NumberSign { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter PerCent { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Plus { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter QuestionMark { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Tilde { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Underscore { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.RedactionCharacter left, Azure.AI.Language.Documents.RedactionCharacter right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.RedactionCharacter (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.RedactionCharacter left, Azure.AI.Language.Documents.RedactionCharacter 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.Documents.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.Documents.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 StringIndexType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StringIndexType(string value) { throw null; } + public static Azure.AI.Language.Documents.StringIndexType TextElementsV8 { get { throw null; } } + public static Azure.AI.Language.Documents.StringIndexType UnicodeCodePoint { get { throw null; } } + public static Azure.AI.Language.Documents.StringIndexType Utf16CodeUnit { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.StringIndexType left, Azure.AI.Language.Documents.StringIndexType right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.StringIndexType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.StringIndexType left, Azure.AI.Language.Documents.StringIndexType right) { throw null; } + public override string ToString() { 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.Documents.SummaryLengthBucket Long { get { throw null; } } + public static Azure.AI.Language.Documents.SummaryLengthBucket Medium { get { throw null; } } + public static Azure.AI.Language.Documents.SummaryLengthBucket Short { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.SummaryLengthBucket left, Azure.AI.Language.Documents.SummaryLengthBucket right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.SummaryLengthBucket (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.SummaryLengthBucket left, Azure.AI.Language.Documents.SummaryLengthBucket 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.Documents.WarningCode DocumentTruncated { get { throw null; } } + public static Azure.AI.Language.Documents.WarningCode LongWordsInDocument { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.WarningCode left, Azure.AI.Language.Documents.WarningCode right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.WarningCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.WarningCode left, Azure.AI.Language.Documents.WarningCode right) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class AILanguageDocumentsClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.netstandard2.0.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.netstandard2.0.cs new file mode 100644 index 000000000000..bcad6a623e6b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/api/Azure.AI.Language.Documents.netstandard2.0.cs @@ -0,0 +1,1031 @@ +namespace Azure.AI.Language.Documents +{ + public partial class AbstractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationActionContent() { } + public string Instruction { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public int? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Documents.StringIndexType? StringIndexType { get { throw null; } set { } } + public Azure.AI.Language.Documents.SummaryLengthBucket? SummaryLength { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationOperationAction(Azure.AI.Language.Documents.AbstractiveSummarizationActionContent actionContent) { } + public Azure.AI.Language.Documents.AbstractiveSummarizationActionContent ActionContent { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsLROResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Documents.DocumentActionState)) { } + public Azure.AI.Language.Documents.AnalyzeDocumentsResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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 static partial class AILanguageDocumentsModelFactory + { + public static Azure.AI.Language.Documents.AbstractiveSummarizationOperationAction AbstractiveSummarizationOperationAction(string name = null, Azure.AI.Language.Documents.AbstractiveSummarizationActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Documents.AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, Azure.AI.Language.Documents.AnalyzeDocumentsResult results = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsDocumentError AnalyzeDocumentsDocumentError(string id = null, Azure.AI.Language.Documents.AnalyzeDocumentsError error = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsError AnalyzeDocumentsError(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode code = default(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Documents.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsJobState AnalyzeDocumentsJobState(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.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), System.Collections.Generic.IEnumerable errors = null, string nextLink = null, Azure.AI.Language.Documents.DocumentActions tasks = null, Azure.AI.Language.Documents.RequestStatistics statistics = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsLROResult AnalyzeDocumentsLROResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, string kind = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput AnalyzeDocumentsOperationInput(string displayName = null, Azure.AI.Language.Documents.MultiLanguageDocumentInput documentsInput = null, System.Collections.Generic.IEnumerable actions = null, string defaultLanguage = null) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsResult AnalyzeDocumentsResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Documents.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Documents.DocumentActions DocumentActions(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.Documents.DocumentAnalysisDocumentResult DocumentAnalysisDocumentResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Documents.DocumentStatistics statistics = null, Azure.AI.Language.Documents.DocumentLocation source = null, System.Collections.Generic.IEnumerable target = null) { throw null; } + public static Azure.AI.Language.Documents.DocumentStatistics DocumentStatistics(int charactersCount = 0, int transactionsCount = 0) { throw null; } + public static Azure.AI.Language.Documents.DocumentWarning DocumentWarning(Azure.AI.Language.Documents.WarningCode code = default(Azure.AI.Language.Documents.WarningCode), string message = null, string targetRef = null) { throw null; } + public static Azure.AI.Language.Documents.ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, Azure.AI.Language.Documents.AnalyzeDocumentsResult results = null) { throw null; } + public static Azure.AI.Language.Documents.InnerErrorModel InnerErrorModel(Azure.AI.Language.Documents.InnerErrorCode code = default(Azure.AI.Language.Documents.InnerErrorCode), string message = null, System.Collections.Generic.IReadOnlyDictionary details = null, string target = null, Azure.AI.Language.Documents.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Documents.MultiLanguageInput MultiLanguageInput(string id = null, Azure.AI.Language.Documents.DocumentLocation source = null, Azure.AI.Language.Documents.DocumentLocation target = null, string language = null) { throw null; } + public static Azure.AI.Language.Documents.PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Documents.DocumentActionState status = default(Azure.AI.Language.Documents.DocumentActionState), string taskName = null, Azure.AI.Language.Documents.AnalyzeDocumentsResult results = null) { throw null; } + public static Azure.AI.Language.Documents.RequestStatistics RequestStatistics(int documentsCount = 0, int validDocumentsCount = 0, int erroneousDocumentsCount = 0, long transactionsCount = (long)0) { throw null; } + } + public partial class AnalyzeDocumentsClient + { + protected AnalyzeDocumentsClient() { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions options) { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public AnalyzeDocumentsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation AnalyzeDocumentsCancelOperation(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeDocumentsCancelOperationAsync(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation AnalyzeDocumentsSubmitOperation(Azure.WaitUntil waitUntil, Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput analyzeDocumentOperationInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation AnalyzeDocumentsSubmitOperation(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeDocumentsSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput analyzeDocumentOperationInput, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeDocumentsSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetAnalyzeDocumentsJobStatus(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetAnalyzeDocumentsJobStatus(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 GetAnalyzeDocumentsJobStatusAsync(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetAnalyzeDocumentsJobStatusAsync(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 partial class AnalyzeDocumentsClientOptions : Azure.Core.ClientOptions + { + public AnalyzeDocumentsClientOptions(Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions.ServiceVersion version = Azure.AI.Language.Documents.AnalyzeDocumentsClientOptions.ServiceVersion.V2024_11_15_Preview) { } + public enum ServiceVersion + { + V2024_11_15_Preview = 1, + } + } + public partial class AnalyzeDocumentsDocumentError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsDocumentError() { } + public Azure.AI.Language.Documents.AnalyzeDocumentsError 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.Documents.AnalyzeDocumentsDocumentError 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.Documents.AnalyzeDocumentsDocumentError 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 AnalyzeDocumentsError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsError() { } + public Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Details { get { throw null; } } + public Azure.AI.Language.Documents.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.Documents.AnalyzeDocumentsError 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.Documents.AnalyzeDocumentsError 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 AnalyzeDocumentsErrorCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AnalyzeDocumentsErrorCode(string value) { throw null; } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchIndexLimitReached { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchIndexNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Conflict { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Forbidden { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode InternalServerError { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode InvalidArgument { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode NotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode OperationNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode ProjectNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode QuotaExceeded { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode ServiceUnavailable { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Timeout { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode TooManyRequests { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Unauthorized { get { throw null; } } + public static Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode Warning { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode 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.Documents.AnalyzeDocumentsErrorCode left, Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode left, Azure.AI.Language.Documents.AnalyzeDocumentsErrorCode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AnalyzeDocumentsJobState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsJobState() { } + 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.Documents.RequestStatistics Statistics { get { throw null; } } + public Azure.AI.Language.Documents.DocumentActionState Status { get { throw null; } } + public Azure.AI.Language.Documents.DocumentActions Tasks { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsJobState 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.Documents.AnalyzeDocumentsJobState 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 AnalyzeDocumentsLROResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeDocumentsLROResult(System.DateTimeOffset lastUpdateDateTime, Azure.AI.Language.Documents.DocumentActionState status) { } + public System.DateTimeOffset LastUpdateDateTime { get { throw null; } } + public Azure.AI.Language.Documents.DocumentActionState Status { get { throw null; } } + public string TaskName { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsLROResult 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.Documents.AnalyzeDocumentsLROResult 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 AnalyzeDocumentsOperationAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeDocumentsOperationAction() { } + public string Name { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsOperationAction 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.Documents.AnalyzeDocumentsOperationAction 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 AnalyzeDocumentsOperationInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AnalyzeDocumentsOperationInput(Azure.AI.Language.Documents.MultiLanguageDocumentInput documentsInput, System.Collections.Generic.IEnumerable actions) { } + public System.Collections.Generic.IList Actions { get { throw null; } } + public string DefaultLanguage { get { throw null; } set { } } + public string DisplayName { get { throw null; } set { } } + public Azure.AI.Language.Documents.MultiLanguageDocumentInput DocumentsInput { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsOperationInput 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.Documents.AnalyzeDocumentsOperationInput 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 AnalyzeDocumentsResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeDocumentsResult() { } + 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.Documents.RequestStatistics Statistics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AnalyzeDocumentsResult 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.Documents.AnalyzeDocumentsResult 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 AzureBlobDocumentLocation : Azure.AI.Language.Documents.DocumentLocation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureBlobDocumentLocation(string location) { } + public string Location { get { throw null; } set { } } + public string ManagedIdentityClientId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.AzureBlobDocumentLocation 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.Documents.AzureBlobDocumentLocation 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 BaseRedactionPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected BaseRedactionPolicy() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.BaseRedactionPolicy 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.Documents.BaseRedactionPolicy 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 CharacterMaskPolicy : Azure.AI.Language.Documents.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CharacterMaskPolicy() { } + public Azure.AI.Language.Documents.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.CharacterMaskPolicy 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.Documents.CharacterMaskPolicy 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 DocumentActions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentActions() { } + 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.Documents.DocumentActions 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.Documents.DocumentActions 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 DocumentActionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DocumentActionState(string value) { throw null; } + public static Azure.AI.Language.Documents.DocumentActionState Cancelled { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Cancelling { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Failed { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState NotStarted { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState PartiallyCompleted { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Running { get { throw null; } } + public static Azure.AI.Language.Documents.DocumentActionState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.DocumentActionState 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.Documents.DocumentActionState left, Azure.AI.Language.Documents.DocumentActionState right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.DocumentActionState (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.DocumentActionState left, Azure.AI.Language.Documents.DocumentActionState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DocumentAnalysisDocumentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentAnalysisDocumentResult() { } + public string Id { get { throw null; } } + public Azure.AI.Language.Documents.DocumentLocation Source { get { throw null; } } + public Azure.AI.Language.Documents.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Target { 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.Documents.DocumentAnalysisDocumentResult 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.Documents.DocumentAnalysisDocumentResult 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 DocumentLocation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DocumentLocation() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.DocumentLocation 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.Documents.DocumentLocation 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 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.Documents.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.Documents.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.Documents.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.Documents.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.Documents.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 EntityMaskPolicy : Azure.AI.Language.Documents.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityMaskPolicy() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.EntityMaskPolicy 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.Documents.EntityMaskPolicy 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.Documents.ExtractiveSummarizationSortingCriteria? SortBy { get { throw null; } set { } } + public Azure.AI.Language.Documents.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExtractiveSummarizationOperationAction() { } + public Azure.AI.Language.Documents.ExtractiveSummarizationActionContent ActionContent { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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.Documents.AnalyzeDocumentsLROResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Documents.DocumentActionState)) { } + public Azure.AI.Language.Documents.AnalyzeDocumentsResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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; } + } + [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.Documents.ExtractiveSummarizationSortingCriteria Offset { get { throw null; } } + public static Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria Rank { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Documents.ExtractiveSummarizationSortingCriteria 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.Documents.InnerErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode EmptyRequest { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode ExtractionFailure { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidCountryHint { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidDocument { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidDocumentBatch { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidParameterValue { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode InvalidRequestBodyFormat { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode KnowledgeBaseNotFound { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode MissingInputDocuments { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode ModelVersionIncorrect { get { throw null; } } + public static Azure.AI.Language.Documents.InnerErrorCode UnsupportedLanguageCode { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.InnerErrorCode left, Azure.AI.Language.Documents.InnerErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.InnerErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.InnerErrorCode left, Azure.AI.Language.Documents.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.Documents.InnerErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Details { get { throw null; } } + public Azure.AI.Language.Documents.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.Documents.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.Documents.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 MultiLanguageDocumentInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MultiLanguageDocumentInput() { } + public System.Collections.Generic.IList Documents { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.MultiLanguageDocumentInput 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.Documents.MultiLanguageDocumentInput 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, Azure.AI.Language.Documents.DocumentLocation source, Azure.AI.Language.Documents.DocumentLocation target) { } + public string Id { get { throw null; } } + public string Language { get { throw null; } set { } } + public Azure.AI.Language.Documents.DocumentLocation Source { get { throw null; } } + public Azure.AI.Language.Documents.DocumentLocation Target { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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 NoMaskPolicy : Azure.AI.Language.Documents.BaseRedactionPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public NoMaskPolicy() { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.NoMaskPolicy 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.Documents.NoMaskPolicy 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.Documents.PiiDomain? Domain { get { throw null; } set { } } + public bool? ExcludeExtractionData { 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.Documents.BaseRedactionPolicy RedactionPolicy { get { throw null; } set { } } + public Azure.AI.Language.Documents.StringIndexType? StringIndexType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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; } + } + [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.Documents.PiiCategoriesExclude AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Address { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Age { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureSas { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Date { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Email { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EsDni { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude IPAddress { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Organization { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude Person { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SaNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SeNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude SwiftCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TwNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude URL { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategoriesExclude ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.PiiCategoriesExclude left, Azure.AI.Language.Documents.PiiCategoriesExclude right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.PiiCategoriesExclude (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.PiiCategoriesExclude left, Azure.AI.Language.Documents.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.Documents.PiiCategory AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Address { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Age { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory All { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureSas { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Date { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Default { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Email { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EsDni { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory IPAddress { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Organization { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory Person { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SaNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SeNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory SwiftCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TwNationalId { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory URL { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Documents.PiiCategory ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.PiiCategory left, Azure.AI.Language.Documents.PiiCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.PiiCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.PiiCategory left, Azure.AI.Language.Documents.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.Documents.PiiDomain None { get { throw null; } } + public static Azure.AI.Language.Documents.PiiDomain Phi { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.PiiDomain left, Azure.AI.Language.Documents.PiiDomain right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.PiiDomain (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.PiiDomain left, Azure.AI.Language.Documents.PiiDomain right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PiiEntityRecognitionOperationResult : Azure.AI.Language.Documents.AnalyzeDocumentsLROResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiEntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Documents.DocumentActionState)) { } + public Azure.AI.Language.Documents.AnalyzeDocumentsResult Results { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.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.Documents.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 PiiLROTask : Azure.AI.Language.Documents.AnalyzeDocumentsOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiLROTask() { } + public Azure.AI.Language.Documents.PiiActionContent Parameters { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Documents.PiiLROTask 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.Documents.PiiLROTask 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 RedactionCharacter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedactionCharacter(string value) { throw null; } + public static Azure.AI.Language.Documents.RedactionCharacter Ampersand { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Asterisk { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter AtSign { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Caret { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Dollar { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter EqualsValue { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter ExclamationPoint { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Minus { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter NumberSign { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter PerCent { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Plus { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter QuestionMark { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Tilde { get { throw null; } } + public static Azure.AI.Language.Documents.RedactionCharacter Underscore { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.RedactionCharacter left, Azure.AI.Language.Documents.RedactionCharacter right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.RedactionCharacter (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.RedactionCharacter left, Azure.AI.Language.Documents.RedactionCharacter 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.Documents.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.Documents.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 StringIndexType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StringIndexType(string value) { throw null; } + public static Azure.AI.Language.Documents.StringIndexType TextElementsV8 { get { throw null; } } + public static Azure.AI.Language.Documents.StringIndexType UnicodeCodePoint { get { throw null; } } + public static Azure.AI.Language.Documents.StringIndexType Utf16CodeUnit { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.StringIndexType left, Azure.AI.Language.Documents.StringIndexType right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.StringIndexType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.StringIndexType left, Azure.AI.Language.Documents.StringIndexType right) { throw null; } + public override string ToString() { 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.Documents.SummaryLengthBucket Long { get { throw null; } } + public static Azure.AI.Language.Documents.SummaryLengthBucket Medium { get { throw null; } } + public static Azure.AI.Language.Documents.SummaryLengthBucket Short { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.SummaryLengthBucket left, Azure.AI.Language.Documents.SummaryLengthBucket right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.SummaryLengthBucket (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.SummaryLengthBucket left, Azure.AI.Language.Documents.SummaryLengthBucket 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.Documents.WarningCode DocumentTruncated { get { throw null; } } + public static Azure.AI.Language.Documents.WarningCode LongWordsInDocument { get { throw null; } } + public bool Equals(Azure.AI.Language.Documents.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.Documents.WarningCode left, Azure.AI.Language.Documents.WarningCode right) { throw null; } + public static implicit operator Azure.AI.Language.Documents.WarningCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Documents.WarningCode left, Azure.AI.Language.Documents.WarningCode right) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class AILanguageDocumentsClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Azure.AI.Language.Documents.csproj b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Azure.AI.Language.Documents.csproj new file mode 100644 index 000000000000..01e9d344268c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Azure.AI.Language.Documents.csproj @@ -0,0 +1,20 @@ + + + This is the Azure.AI.Language.Documents client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.AI.Language.Documents for Azure Data Plane + 1.0.0-beta.1 + Azure.AI.Language.Documents + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsClientBuilderExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsClientBuilderExtensions.cs new file mode 100644 index 000000000000..ab597a4970d9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsClientBuilderExtensions.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.Documents; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AILanguageDocumentsClientBuilderExtensions + { + /// 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 AddAnalyzeDocumentsClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new AnalyzeDocumentsClient(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 AddAnalyzeDocumentsClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new AnalyzeDocumentsClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddAnalyzeDocumentsClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsModelFactory.cs new file mode 100644 index 000000000000..f7bca282d16c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AILanguageDocumentsModelFactory.cs @@ -0,0 +1,300 @@ +// 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.Documents +{ + /// Model factory for models. + public static partial class AILanguageDocumentsModelFactory + { + /// 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 AnalyzeDocumentsJobState AnalyzeDocumentsJobState(string displayName = null, DateTimeOffset createdAt = default, DateTimeOffset? expiresOn = null, Guid jobId = default, DateTimeOffset lastUpdatedAt = default, DocumentActionState status = default, IEnumerable errors = null, string nextLink = null, DocumentActions tasks = null, RequestStatistics statistics = null) + { + errors ??= new List(); + + return new AnalyzeDocumentsJobState( + displayName, + createdAt, + expiresOn, + jobId, + lastUpdatedAt, + status, + errors?.ToList(), + nextLink, + tasks, + statistics, + 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 AnalyzeDocumentsError AnalyzeDocumentsError(AnalyzeDocumentsErrorCode code = default, string message = null, string target = null, IEnumerable details = null, InnerErrorModel innererror = null) + { + details ??= new List(); + + return new AnalyzeDocumentsError( + 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 . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + /// + /// Enumerable of Analyze documents 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 DocumentActions DocumentActions(int completed = default, int failed = default, int inProgress = default, int total = default, IEnumerable items = null) + { + items ??= new List(); + + return new DocumentActions( + 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 AnalyzeDocumentsLROResult AnalyzeDocumentsLROResult(DateTimeOffset lastUpdateDateTime = default, DocumentActionState status = default, string taskName = null, string kind = null) + { + return new UnknownAnalyzeDocumentsLROResult(lastUpdateDateTime, status, taskName, kind == null ? default : new AnalyzeDocumentsOperationResultsKind(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. + /// The list of pii document results. + /// A new instance for mocking. + public static PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, DocumentActionState status = default, string taskName = null, AnalyzeDocumentsResult results = null) + { + return new PiiEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + AnalyzeDocumentsOperationResultsKind.PiiEntityRecognitionOperationResults, + 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 analysis. + /// Response by document. + /// A new instance for mocking. + public static AnalyzeDocumentsResult AnalyzeDocumentsResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new AnalyzeDocumentsResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Document Id. + /// Document Error. + /// A new instance for mocking. + public static AnalyzeDocumentsDocumentError AnalyzeDocumentsDocumentError(string id = null, AnalyzeDocumentsError error = null) + { + return new AnalyzeDocumentsDocumentError(id, error, 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. + /// + /// Location of the input document. + /// 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 . + /// + /// + /// Array of document results generated after the analysis. + /// 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 . + /// + /// A new instance for mocking. + public static DocumentAnalysisDocumentResult DocumentAnalysisDocumentResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DocumentLocation source = null, IEnumerable target = null) + { + warnings ??= new List(); + target ??= new List(); + + return new DocumentAnalysisDocumentResult( + id, + warnings?.ToList(), + statistics, + source, + target?.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 documents 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 . + /// 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 document task. + /// A new instance for mocking. + public static ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, DocumentActionState status = default, string taskName = null, AnalyzeDocumentsResult results = null) + { + return new ExtractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + AnalyzeDocumentsOperationResultsKind.ExtractiveSummarizationOperationResults, + 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 AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, DocumentActionState status = default, string taskName = null, AnalyzeDocumentsResult results = null) + { + return new AbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + AnalyzeDocumentsOperationResultsKind.AbstractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// 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. + /// A new instance for mocking. + public static AnalyzeDocumentsOperationInput AnalyzeDocumentsOperationInput(string displayName = null, MultiLanguageDocumentInput documentsInput = null, IEnumerable actions = null, string defaultLanguage = null) + { + actions ??= new List(); + + return new AnalyzeDocumentsOperationInput(displayName, documentsInput, actions?.ToList(), defaultLanguage, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// + /// The location of the input document to process. + /// 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 . + /// + /// + /// The location where the processed document will be stored. + /// 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 . + /// + /// (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. + /// A new instance for mocking. + public static MultiLanguageInput MultiLanguageInput(string id = null, DocumentLocation source = null, DocumentLocation target = null, string language = null) + { + return new MultiLanguageInput(id, source, target, language, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// task name. + /// Parameters for the Abstractive Summarization task. + /// A new instance for mocking. + public static AbstractiveSummarizationOperationAction AbstractiveSummarizationOperationAction(string name = null, AbstractiveSummarizationActionContent actionContent = null) + { + return new AbstractiveSummarizationOperationAction(name, AnalyzeDocumentsOperationActionKind.AbstractiveSummarization, serializedAdditionalRawData: null, actionContent); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 000000000000..8a4f86be2c7b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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(Instruction)) + { + writer.WritePropertyName("instruction"u8); + writer.WriteStringValue(Instruction); + } + 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 instruction = 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("instruction"u8)) + { + instruction = 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, + instruction, + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationActionContent.cs new file mode 100644 index 000000000000..22ef2e418953 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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 instruction 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 instruction, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + Instruction = instruction; + _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 instruction will be used to generate the summary. + public string Instruction { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 000000000000..5507e1c2d5b2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationAction.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.Documents +{ + 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); + 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; + AnalyzeDocumentsOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + parameters = AbstractiveSummarizationActionContent.DeserializeAbstractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeDocumentsOperationActionKind(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationAction.cs new file mode 100644 index 000000000000..5336417d369a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationAction.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.Documents +{ + /// An object representing the task definition for an Abstractive Summarization task. + public partial class AbstractiveSummarizationOperationAction : AnalyzeDocumentsOperationAction + { + /// Initializes a new instance of . + /// Parameters for the Abstractive Summarization task. + /// is null. + public AbstractiveSummarizationOperationAction(AbstractiveSummarizationActionContent actionContent) + { + Argument.AssertNotNull(actionContent, nameof(actionContent)); + + Kind = AnalyzeDocumentsOperationActionKind.AbstractiveSummarization; + 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 Abstractive Summarization task. + internal AbstractiveSummarizationOperationAction(string name, AnalyzeDocumentsOperationActionKind kind, IDictionary serializedAdditionalRawData, AbstractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummarizationOperationAction() + { + } + + /// Parameters for the Abstractive Summarization task. + public AbstractiveSummarizationActionContent ActionContent { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 000000000000..87ebb2b335f7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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; + } + AnalyzeDocumentsResult results = default; + DateTimeOffset lastUpdateDateTime = default; + DocumentActionState status = default; + string taskName = default; + AnalyzeDocumentsOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = AnalyzeDocumentsResult.DeserializeAnalyzeDocumentsResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new DocumentActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeDocumentsOperationResultsKind(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AbstractiveSummarizationOperationResult.cs new file mode 100644 index 000000000000..78c25251f979 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// An object representing the results for an Abstractive Summarization task. + public partial class AbstractiveSummarizationOperationResult : AnalyzeDocumentsLROResult + { + /// 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, DocumentActionState status, AnalyzeDocumentsResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeDocumentsOperationResultsKind.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, DocumentActionState status, string taskName, AnalyzeDocumentsOperationResultsKind kind, IDictionary serializedAdditionalRawData, AnalyzeDocumentsResult results) : base(lastUpdateDateTime, status, taskName, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public AnalyzeDocumentsResult Results { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsClient.cs new file mode 100644 index 000000000000..86e80cc8aa16 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsClient.cs @@ -0,0 +1,457 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.Documents +{ + // 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://learn.microsoft.com/azure/cognitive-services/language-service/overview\">https://learn.microsoft.com/azure/cognitive-services/language-service/overview</a>.0 + /// + public partial class AnalyzeDocumentsClient + { + 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 AnalyzeDocumentsClient for mocking. + protected AnalyzeDocumentsClient() + { + } + + /// Initializes a new instance of AnalyzeDocumentsClient. + /// 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 AnalyzeDocumentsClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new AnalyzeDocumentsClientOptions()) + { + } + + /// Initializes a new instance of AnalyzeDocumentsClient. + /// 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 AnalyzeDocumentsClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new AnalyzeDocumentsClientOptions()) + { + } + + /// Initializes a new instance of AnalyzeDocumentsClient. + /// 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 AnalyzeDocumentsClient(Uri endpoint, AzureKeyCredential credential, AnalyzeDocumentsClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AnalyzeDocumentsClientOptions(); + + 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 AnalyzeDocumentsClient. + /// 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 AnalyzeDocumentsClient(Uri endpoint, TokenCredential credential, AnalyzeDocumentsClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new AnalyzeDocumentsClientOptions(); + + 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; + } + + /// 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 a document 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> GetAnalyzeDocumentsJobStatusAsync(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAnalyzeDocumentsJobStatusAsync(jobId, showStats, top, skip, context).ConfigureAwait(false); + return Response.FromValue(AnalyzeDocumentsJobState.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 a document 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 GetAnalyzeDocumentsJobStatus(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAnalyzeDocumentsJobStatus(jobId, showStats, top, skip, context); + return Response.FromValue(AnalyzeDocumentsJobState.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 GetAnalyzeDocumentsJobStatusAsync(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AnalyzeDocumentsClient.GetAnalyzeDocumentsJobStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAnalyzeDocumentsJobStatusRequest(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 GetAnalyzeDocumentsJobStatus(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("AnalyzeDocumentsClient.GetAnalyzeDocumentsJobStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAnalyzeDocumentsJobStatusRequest(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. + /// The input for the analyze documents operation. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task AnalyzeDocumentsSubmitOperationAsync(WaitUntil waitUntil, AnalyzeDocumentsOperationInput analyzeDocumentOperationInput, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(analyzeDocumentOperationInput, nameof(analyzeDocumentOperationInput)); + + using RequestContent content = analyzeDocumentOperationInput.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + return await AnalyzeDocumentsSubmitOperationAsync(waitUntil, content, 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. + /// The input for the analyze documents operation. + /// The cancellation token to use. + /// is null. + /// + public virtual Operation AnalyzeDocumentsSubmitOperation(WaitUntil waitUntil, AnalyzeDocumentsOperationInput analyzeDocumentOperationInput, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(analyzeDocumentOperationInput, nameof(analyzeDocumentOperationInput)); + + using RequestContent content = analyzeDocumentOperationInput.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + return AnalyzeDocumentsSubmitOperation(waitUntil, content, 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 AnalyzeDocumentsSubmitOperationAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AnalyzeDocumentsClient.AnalyzeDocumentsSubmitOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeDocumentsSubmitOperationRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "AnalyzeDocumentsClient.AnalyzeDocumentsSubmitOperation", 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 AnalyzeDocumentsSubmitOperation(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("AnalyzeDocumentsClient.AnalyzeDocumentsSubmitOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeDocumentsSubmitOperationRequest(content, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "AnalyzeDocumentsClient.AnalyzeDocumentsSubmitOperation", 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 AnalyzeDocumentsCancelOperationAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("AnalyzeDocumentsClient.AnalyzeDocumentsCancelOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeDocumentsCancelOperationRequest(jobId, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "AnalyzeDocumentsClient.AnalyzeDocumentsCancelOperation", 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 AnalyzeDocumentsCancelOperation(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("AnalyzeDocumentsClient.AnalyzeDocumentsCancelOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeDocumentsCancelOperationRequest(jobId, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "AnalyzeDocumentsClient.AnalyzeDocumentsCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetAnalyzeDocumentsJobStatusRequest(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-documents/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 CreateAnalyzeDocumentsSubmitOperationRequest(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-documents/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 CreateAnalyzeDocumentsCancelOperationRequest(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-documents/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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsClientOptions.cs new file mode 100644 index 000000000000..e6adcfa53824 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.Language.Documents +{ + /// Client options for AnalyzeDocumentsClient. + public partial class AnalyzeDocumentsClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2024_11_15_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2024-11-15-preview". + V2024_11_15_Preview = 1, + } + + internal string Version { get; } + + /// Initializes new instance of AnalyzeDocumentsClientOptions. + public AnalyzeDocumentsClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2024_11_15_Preview => "2024-11-15-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsDocumentError.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsDocumentError.Serialization.cs new file mode 100644 index 000000000000..9f401824408b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsDocumentError.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.Documents +{ + public partial class AnalyzeDocumentsDocumentError : 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(AnalyzeDocumentsDocumentError)} 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 + } + } + } + + AnalyzeDocumentsDocumentError 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(AnalyzeDocumentsDocumentError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsDocumentError(document.RootElement, options); + } + + internal static AnalyzeDocumentsDocumentError DeserializeAnalyzeDocumentsDocumentError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + AnalyzeDocumentsError 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 = AnalyzeDocumentsError.DeserializeAnalyzeDocumentsError(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeDocumentsDocumentError(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(AnalyzeDocumentsDocumentError)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsDocumentError 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 DeserializeAnalyzeDocumentsDocumentError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsDocumentError)} 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 AnalyzeDocumentsDocumentError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsDocumentError(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsDocumentError.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsDocumentError.cs new file mode 100644 index 000000000000..6c42cc57b83c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsDocumentError.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.Documents +{ + /// Contains the error object with errors encountered for the processed document. + public partial class AnalyzeDocumentsDocumentError + { + /// + /// 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 . + /// Document Id. + /// Document Error. + /// or is null. + internal AnalyzeDocumentsDocumentError(string id, AnalyzeDocumentsError error) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(error, nameof(error)); + + Id = id; + Error = error; + } + + /// Initializes a new instance of . + /// Document Id. + /// Document Error. + /// Keeps track of any properties unknown to the library. + internal AnalyzeDocumentsDocumentError(string id, AnalyzeDocumentsError error, IDictionary serializedAdditionalRawData) + { + Id = id; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeDocumentsDocumentError() + { + } + + /// Document Id. + public string Id { get; } + /// Document Error. + public AnalyzeDocumentsError Error { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsError.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsError.Serialization.cs new file mode 100644 index 000000000000..7f47915a9d5a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsError.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.Documents +{ + public partial class AnalyzeDocumentsError : 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(AnalyzeDocumentsError)} 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 + } + } + } + + AnalyzeDocumentsError 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(AnalyzeDocumentsError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsError(document.RootElement, options); + } + + internal static AnalyzeDocumentsError DeserializeAnalyzeDocumentsError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeDocumentsErrorCode 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 AnalyzeDocumentsErrorCode(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(DeserializeAnalyzeDocumentsError(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 AnalyzeDocumentsError( + 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(AnalyzeDocumentsError)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsError 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 DeserializeAnalyzeDocumentsError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsError)} 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 AnalyzeDocumentsError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsError(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsError.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsError.cs new file mode 100644 index 000000000000..c8a932636311 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsError.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.Documents +{ + /// The error response object returned when the service encounters some errors during processing the request. + public partial class AnalyzeDocumentsError + { + /// + /// 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 AnalyzeDocumentsError(AnalyzeDocumentsErrorCode 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 AnalyzeDocumentsError(AnalyzeDocumentsErrorCode 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 AnalyzeDocumentsError() + { + } + + /// One of a server-defined set of error codes. + public AnalyzeDocumentsErrorCode 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsErrorCode.cs new file mode 100644 index 000000000000..ea736ac120f8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsErrorCode.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.Documents +{ + /// Human-readable error code. + public readonly partial struct AnalyzeDocumentsErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeDocumentsErrorCode(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 AnalyzeDocumentsErrorCode InvalidRequest { get; } = new AnalyzeDocumentsErrorCode(InvalidRequestValue); + /// Invalid argument error. + public static AnalyzeDocumentsErrorCode InvalidArgument { get; } = new AnalyzeDocumentsErrorCode(InvalidArgumentValue); + /// Unauthorized access error. + public static AnalyzeDocumentsErrorCode Unauthorized { get; } = new AnalyzeDocumentsErrorCode(UnauthorizedValue); + /// Forbidden access error. + public static AnalyzeDocumentsErrorCode Forbidden { get; } = new AnalyzeDocumentsErrorCode(ForbiddenValue); + /// Not found error. + public static AnalyzeDocumentsErrorCode NotFound { get; } = new AnalyzeDocumentsErrorCode(NotFoundValue); + /// Project not found error. + public static AnalyzeDocumentsErrorCode ProjectNotFound { get; } = new AnalyzeDocumentsErrorCode(ProjectNotFoundValue); + /// Operation not found error. + public static AnalyzeDocumentsErrorCode OperationNotFound { get; } = new AnalyzeDocumentsErrorCode(OperationNotFoundValue); + /// Azure Cognitive Search not found error. + public static AnalyzeDocumentsErrorCode AzureCognitiveSearchNotFound { get; } = new AnalyzeDocumentsErrorCode(AzureCognitiveSearchNotFoundValue); + /// Azure Cognitive Search index not found error. + public static AnalyzeDocumentsErrorCode AzureCognitiveSearchIndexNotFound { get; } = new AnalyzeDocumentsErrorCode(AzureCognitiveSearchIndexNotFoundValue); + /// Too many requests error. + public static AnalyzeDocumentsErrorCode TooManyRequests { get; } = new AnalyzeDocumentsErrorCode(TooManyRequestsValue); + /// Azure Cognitive Search throttling error. + public static AnalyzeDocumentsErrorCode AzureCognitiveSearchThrottling { get; } = new AnalyzeDocumentsErrorCode(AzureCognitiveSearchThrottlingValue); + /// Azure Cognitive Search index limit reached error. + public static AnalyzeDocumentsErrorCode AzureCognitiveSearchIndexLimitReached { get; } = new AnalyzeDocumentsErrorCode(AzureCognitiveSearchIndexLimitReachedValue); + /// Internal server error. + public static AnalyzeDocumentsErrorCode InternalServerError { get; } = new AnalyzeDocumentsErrorCode(InternalServerErrorValue); + /// Service unavailable error. + public static AnalyzeDocumentsErrorCode ServiceUnavailable { get; } = new AnalyzeDocumentsErrorCode(ServiceUnavailableValue); + /// Timeout error. + public static AnalyzeDocumentsErrorCode Timeout { get; } = new AnalyzeDocumentsErrorCode(TimeoutValue); + /// Quota exceeded error. + public static AnalyzeDocumentsErrorCode QuotaExceeded { get; } = new AnalyzeDocumentsErrorCode(QuotaExceededValue); + /// Conflict error. + public static AnalyzeDocumentsErrorCode Conflict { get; } = new AnalyzeDocumentsErrorCode(ConflictValue); + /// Warning error. + public static AnalyzeDocumentsErrorCode Warning { get; } = new AnalyzeDocumentsErrorCode(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeDocumentsErrorCode left, AnalyzeDocumentsErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeDocumentsErrorCode left, AnalyzeDocumentsErrorCode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeDocumentsErrorCode(string value) => new AnalyzeDocumentsErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeDocumentsErrorCode other && Equals(other); + /// + public bool Equals(AnalyzeDocumentsErrorCode 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsJobState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsJobState.Serialization.cs new file mode 100644 index 000000000000..7bec2145e7b4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsJobState.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.Documents +{ + public partial class AnalyzeDocumentsJobState : 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(AnalyzeDocumentsJobState)} 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(Tasks, 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 + } + } + } + + AnalyzeDocumentsJobState 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(AnalyzeDocumentsJobState)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsJobState(document.RootElement, options); + } + + internal static AnalyzeDocumentsJobState DeserializeAnalyzeDocumentsJobState(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; + DocumentActionState status = default; + IReadOnlyList errors = default; + string nextLink = default; + DocumentActions 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 DocumentActionState(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(AnalyzeDocumentsError.DeserializeAnalyzeDocumentsError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("tasks"u8)) + { + tasks = DocumentActions.DeserializeDocumentActions(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 AnalyzeDocumentsJobState( + 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(AnalyzeDocumentsJobState)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsJobState 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 DeserializeAnalyzeDocumentsJobState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsJobState)} 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 AnalyzeDocumentsJobState FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsJobState(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsJobState.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsJobState.cs new file mode 100644 index 000000000000..4663aea1aa4c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsJobState.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.Documents +{ + /// The object containing the analyze job LRO job state. + public partial class AnalyzeDocumentsJobState + { + /// + /// 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 AnalyzeDocumentsJobState(DateTimeOffset createdAt, DateTimeOffset lastUpdatedAt, DocumentActionState status, DocumentActions tasks) + { + Argument.AssertNotNull(tasks, nameof(tasks)); + + CreatedAt = createdAt; + LastUpdatedAt = lastUpdatedAt; + Status = status; + Errors = new ChangeTrackingList(); + Tasks = tasks; + } + + /// 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 AnalyzeDocumentsJobState(string displayName, DateTimeOffset createdAt, DateTimeOffset? expiresOn, Guid jobId, DateTimeOffset lastUpdatedAt, DocumentActionState status, IReadOnlyList errors, string nextLink, DocumentActions tasks, RequestStatistics statistics, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + CreatedAt = createdAt; + ExpiresOn = expiresOn; + JobId = jobId; + LastUpdatedAt = lastUpdatedAt; + Status = status; + Errors = errors; + NextLink = nextLink; + Tasks = tasks; + Statistics = statistics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeDocumentsJobState() + { + } + + /// 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 DocumentActionState Status { get; } + /// errors. + public IReadOnlyList Errors { get; } + /// next link. + public string NextLink { get; } + /// List of tasks. + public DocumentActions Tasks { 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsLROResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsLROResult.Serialization.cs new file mode 100644 index 000000000000..9a138fbf1af1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsLROResult.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Documents +{ + [PersistableModelProxy(typeof(UnknownAnalyzeDocumentsLROResult))] + public partial class AnalyzeDocumentsLROResult : 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(AnalyzeDocumentsLROResult)} 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(TaskName)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(TaskName); + } + 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 + } + } + } + + AnalyzeDocumentsLROResult 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(AnalyzeDocumentsLROResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsLROResult(document.RootElement, options); + } + + internal static AnalyzeDocumentsLROResult DeserializeAnalyzeDocumentsLROResult(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 "ExtractiveSummarizationLROResults": return ExtractiveSummarizationOperationResult.DeserializeExtractiveSummarizationOperationResult(element, options); + case "PiiEntityRecognitionLROResults": return PiiEntityRecognitionOperationResult.DeserializePiiEntityRecognitionOperationResult(element, options); + } + } + return UnknownAnalyzeDocumentsLROResult.DeserializeUnknownAnalyzeDocumentsLROResult(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(AnalyzeDocumentsLROResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsLROResult 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 DeserializeAnalyzeDocumentsLROResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsLROResult)} 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 AnalyzeDocumentsLROResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsLROResult(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsLROResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsLROResult.cs new file mode 100644 index 000000000000..774a66e4f455 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsLROResult.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.Documents +{ + /// + /// Contains the AnalyzeDocuments 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 AnalyzeDocumentsLROResult + { + /// + /// 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 AnalyzeDocumentsLROResult(DateTimeOffset lastUpdateDateTime, DocumentActionState 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 AnalyzeDocumentsLROResult(DateTimeOffset lastUpdateDateTime, DocumentActionState status, string taskName, AnalyzeDocumentsOperationResultsKind kind, IDictionary serializedAdditionalRawData) + { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; + TaskName = taskName; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeDocumentsLROResult() + { + } + + /// 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 DocumentActionState Status { get; } + /// task name. + public string TaskName { get; } + /// Kind of the task. + internal AnalyzeDocumentsOperationResultsKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationAction.Serialization.cs new file mode 100644 index 000000000000..0a101869498a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationAction.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Documents +{ + [PersistableModelProxy(typeof(UnknownAnalyzeDocumentsOperationAction))] + public partial class AnalyzeDocumentsOperationAction : 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(AnalyzeDocumentsOperationAction)} 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 + } + } + } + + AnalyzeDocumentsOperationAction 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(AnalyzeDocumentsOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsOperationAction(document.RootElement, options); + } + + internal static AnalyzeDocumentsOperationAction DeserializeAnalyzeDocumentsOperationAction(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 "ExtractiveSummarization": return ExtractiveSummarizationOperationAction.DeserializeExtractiveSummarizationOperationAction(element, options); + case "PiiEntityRecognition": return PiiLROTask.DeserializePiiLROTask(element, options); + } + } + return UnknownAnalyzeDocumentsOperationAction.DeserializeUnknownAnalyzeDocumentsOperationAction(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(AnalyzeDocumentsOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsOperationAction 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 DeserializeAnalyzeDocumentsOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsOperationAction)} 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 AnalyzeDocumentsOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsOperationAction(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationAction.cs new file mode 100644 index 000000000000..b7d8e0caf4c1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationAction.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.Documents +{ + /// + /// 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 AnalyzeDocumentsOperationAction + { + /// + /// 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 AnalyzeDocumentsOperationAction() + { + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal AnalyzeDocumentsOperationAction(string name, AnalyzeDocumentsOperationActionKind kind, IDictionary serializedAdditionalRawData) + { + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// task name. + public string Name { get; set; } + /// The kind of task to perform. + internal AnalyzeDocumentsOperationActionKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationActionKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationActionKind.cs new file mode 100644 index 000000000000..6595b48120dd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationActionKind.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.Documents +{ + /// The kind of the long running analyze documents tasks supported. + internal readonly partial struct AnalyzeDocumentsOperationActionKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeDocumentsOperationActionKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PiiEntityRecognitionValue = "PiiEntityRecognition"; + private const string ExtractiveSummarizationValue = "ExtractiveSummarization"; + private const string AbstractiveSummarizationValue = "AbstractiveSummarization"; + + /// PII entity recognition task. + public static AnalyzeDocumentsOperationActionKind PiiEntityRecognition { get; } = new AnalyzeDocumentsOperationActionKind(PiiEntityRecognitionValue); + /// Extractive summarization task. + public static AnalyzeDocumentsOperationActionKind ExtractiveSummarization { get; } = new AnalyzeDocumentsOperationActionKind(ExtractiveSummarizationValue); + /// Abstractive summarization task. + public static AnalyzeDocumentsOperationActionKind AbstractiveSummarization { get; } = new AnalyzeDocumentsOperationActionKind(AbstractiveSummarizationValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeDocumentsOperationActionKind left, AnalyzeDocumentsOperationActionKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeDocumentsOperationActionKind left, AnalyzeDocumentsOperationActionKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeDocumentsOperationActionKind(string value) => new AnalyzeDocumentsOperationActionKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeDocumentsOperationActionKind other && Equals(other); + /// + public bool Equals(AnalyzeDocumentsOperationActionKind 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationInput.Serialization.cs new file mode 100644 index 000000000000..7396f31afdf9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationInput.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.Documents +{ + public partial class AnalyzeDocumentsOperationInput : 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(AnalyzeDocumentsOperationInput)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(DocumentsInput, 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 + } + } + } + + AnalyzeDocumentsOperationInput 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(AnalyzeDocumentsOperationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsOperationInput(document.RootElement, options); + } + + internal static AnalyzeDocumentsOperationInput DeserializeAnalyzeDocumentsOperationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + MultiLanguageDocumentInput analysisInput = default; + IList 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 = MultiLanguageDocumentInput.DeserializeMultiLanguageDocumentInput(property.Value, options); + continue; + } + if (property.NameEquals("tasks"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeDocumentsOperationAction.DeserializeAnalyzeDocumentsOperationAction(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 AnalyzeDocumentsOperationInput(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(AnalyzeDocumentsOperationInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsOperationInput 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 DeserializeAnalyzeDocumentsOperationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsOperationInput)} 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 AnalyzeDocumentsOperationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsOperationInput(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationInput.cs new file mode 100644 index 000000000000..d4464d73ce72 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationInput.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.Documents +{ + /// The input object for the analyze documents LRO. + public partial class AnalyzeDocumentsOperationInput + { + /// + /// 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. + public AnalyzeDocumentsOperationInput(MultiLanguageDocumentInput documentsInput, IEnumerable actions) + { + Argument.AssertNotNull(documentsInput, nameof(documentsInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + DocumentsInput = documentsInput; + 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. + /// Keeps track of any properties unknown to the library. + internal AnalyzeDocumentsOperationInput(string displayName, MultiLanguageDocumentInput documentsInput, IList actions, string defaultLanguage, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + DocumentsInput = documentsInput; + Actions = actions; + DefaultLanguage = defaultLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeDocumentsOperationInput() + { + } + + /// Name for the task. + public string DisplayName { get; set; } + /// Contains the input to be analyzed. + public MultiLanguageDocumentInput DocumentsInput { 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 IList Actions { get; } + /// Default language to use for records. + public string DefaultLanguage { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationResultsKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationResultsKind.cs new file mode 100644 index 000000000000..d4120af3f15f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsOperationResultsKind.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.Documents +{ + /// The kind of the response object returned by the analyze-documents long running task. + internal readonly partial struct AnalyzeDocumentsOperationResultsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeDocumentsOperationResultsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PiiEntityRecognitionOperationResultsValue = "PiiEntityRecognitionLROResults"; + private const string ExtractiveSummarizationOperationResultsValue = "ExtractiveSummarizationLROResults"; + private const string AbstractiveSummarizationOperationResultsValue = "AbstractiveSummarizationLROResults"; + + /// PII entity recognition LRO results. + public static AnalyzeDocumentsOperationResultsKind PiiEntityRecognitionOperationResults { get; } = new AnalyzeDocumentsOperationResultsKind(PiiEntityRecognitionOperationResultsValue); + /// Extractive summarization LRO results. + public static AnalyzeDocumentsOperationResultsKind ExtractiveSummarizationOperationResults { get; } = new AnalyzeDocumentsOperationResultsKind(ExtractiveSummarizationOperationResultsValue); + /// Abstractive summarization LRO results. + public static AnalyzeDocumentsOperationResultsKind AbstractiveSummarizationOperationResults { get; } = new AnalyzeDocumentsOperationResultsKind(AbstractiveSummarizationOperationResultsValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeDocumentsOperationResultsKind left, AnalyzeDocumentsOperationResultsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeDocumentsOperationResultsKind left, AnalyzeDocumentsOperationResultsKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AnalyzeDocumentsOperationResultsKind(string value) => new AnalyzeDocumentsOperationResultsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeDocumentsOperationResultsKind other && Equals(other); + /// + public bool Equals(AnalyzeDocumentsOperationResultsKind 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsResult.Serialization.cs new file mode 100644 index 000000000000..d264e77f3bdd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsResult.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.Documents +{ + public partial class AnalyzeDocumentsResult : 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(AnalyzeDocumentsResult)} 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 + } + } + } + + AnalyzeDocumentsResult 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(AnalyzeDocumentsResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsResult(document.RootElement, options); + } + + internal static AnalyzeDocumentsResult DeserializeAnalyzeDocumentsResult(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(AnalyzeDocumentsDocumentError.DeserializeAnalyzeDocumentsDocumentError(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(DocumentAnalysisDocumentResult.DeserializeDocumentAnalysisDocumentResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeDocumentsResult(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(AnalyzeDocumentsResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsResult 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 DeserializeAnalyzeDocumentsResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsResult)} 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 AnalyzeDocumentsResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeDocumentsResult(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsResult.cs new file mode 100644 index 000000000000..cbc07172d3b7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AnalyzeDocumentsResult.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.Documents +{ + /// Contains the result object for the processed document. + public partial class AnalyzeDocumentsResult + { + /// + /// 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 analysis. + /// Response by document. + /// , or is null. + internal AnalyzeDocumentsResult(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 analysis. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal AnalyzeDocumentsResult(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 AnalyzeDocumentsResult() + { + } + + /// 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 analysis. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AzureBlobDocumentLocation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AzureBlobDocumentLocation.Serialization.cs new file mode 100644 index 000000000000..6c86a6e6f452 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AzureBlobDocumentLocation.Serialization.cs @@ -0,0 +1,145 @@ +// 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.Documents +{ + public partial class AzureBlobDocumentLocation : 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(AzureBlobDocumentLocation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (Optional.IsDefined(ManagedIdentityClientId)) + { + writer.WritePropertyName("managedIdentityClientId"u8); + writer.WriteStringValue(ManagedIdentityClientId); + } + } + + AzureBlobDocumentLocation 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(AzureBlobDocumentLocation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureBlobDocumentLocation(document.RootElement, options); + } + + internal static AzureBlobDocumentLocation DeserializeAzureBlobDocumentLocation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string location = default; + string managedIdentityClientId = default; + DocumentLocationKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("managedIdentityClientId"u8)) + { + managedIdentityClientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new DocumentLocationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureBlobDocumentLocation(kind, serializedAdditionalRawData, location, managedIdentityClientId); + } + + 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(AzureBlobDocumentLocation)} does not support writing '{options.Format}' format."); + } + } + + AzureBlobDocumentLocation 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 DeserializeAzureBlobDocumentLocation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureBlobDocumentLocation)} 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 AzureBlobDocumentLocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureBlobDocumentLocation(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AzureBlobDocumentLocation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AzureBlobDocumentLocation.cs new file mode 100644 index 000000000000..9ee79f9f2655 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/AzureBlobDocumentLocation.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Documents +{ + /// Document location for azure blobs. + public partial class AzureBlobDocumentLocation : DocumentLocation + { + /// Initializes a new instance of . + /// The location of the document. + /// is null. + public AzureBlobDocumentLocation(string location) + { + Argument.AssertNotNull(location, nameof(location)); + + Kind = DocumentLocationKind.AzureBlob; + Location = location; + } + + /// Initializes a new instance of . + /// The kind of the document location. + /// Keeps track of any properties unknown to the library. + /// The location of the document. + /// The user managed identity client Id to use to authenticate with the storage account. + internal AzureBlobDocumentLocation(DocumentLocationKind kind, IDictionary serializedAdditionalRawData, string location, string managedIdentityClientId) : base(kind, serializedAdditionalRawData) + { + Location = location; + ManagedIdentityClientId = managedIdentityClientId; + } + + /// Initializes a new instance of for deserialization. + internal AzureBlobDocumentLocation() + { + } + + /// The location of the document. + public string Location { get; set; } + /// The user managed identity client Id to use to authenticate with the storage account. + public string ManagedIdentityClientId { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/BaseRedactionPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/BaseRedactionPolicy.Serialization.cs new file mode 100644 index 000000000000..5e6def2d4800 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/BaseRedactionPolicy.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.Documents +{ + [PersistableModelProxy(typeof(UnknownBaseRedactionPolicy))] + public partial class BaseRedactionPolicy : 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(BaseRedactionPolicy)} 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 + } + } + } + + BaseRedactionPolicy 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(BaseRedactionPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseRedactionPolicy(document.RootElement, options); + } + + internal static BaseRedactionPolicy DeserializeBaseRedactionPolicy(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 "characterMask": return CharacterMaskPolicy.DeserializeCharacterMaskPolicy(element, options); + case "entityMask": return EntityMaskPolicy.DeserializeEntityMaskPolicy(element, options); + case "noMask": return NoMaskPolicy.DeserializeNoMaskPolicy(element, options); + } + } + return UnknownBaseRedactionPolicy.DeserializeUnknownBaseRedactionPolicy(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(BaseRedactionPolicy)} does not support writing '{options.Format}' format."); + } + } + + BaseRedactionPolicy 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 DeserializeBaseRedactionPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} 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 BaseRedactionPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBaseRedactionPolicy(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/BaseRedactionPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/BaseRedactionPolicy.cs new file mode 100644 index 000000000000..c2b8dc2e58bf --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/BaseRedactionPolicy.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.Documents +{ + /// + /// The abstract base class for RedactionPolicy. + /// 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 BaseRedactionPolicy + { + /// + /// 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 BaseRedactionPolicy() + { + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal BaseRedactionPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) + { + PolicyKind = policyKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity RedactionPolicy object kind. + internal RedactionPolicyKind PolicyKind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/CharacterMaskPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/CharacterMaskPolicy.Serialization.cs new file mode 100644 index 000000000000..33c80de49682 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/CharacterMaskPolicy.Serialization.cs @@ -0,0 +1,141 @@ +// 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.Documents +{ + public partial class CharacterMaskPolicy : 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(CharacterMaskPolicy)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(RedactionCharacter)) + { + writer.WritePropertyName("redactionCharacter"u8); + writer.WriteStringValue(RedactionCharacter.Value.ToString()); + } + } + + CharacterMaskPolicy 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(CharacterMaskPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCharacterMaskPolicy(document.RootElement, options); + } + + internal static CharacterMaskPolicy DeserializeCharacterMaskPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionCharacter? redactionCharacter = default; + RedactionPolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("redactionCharacter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionCharacter = new RedactionCharacter(property.Value.GetString()); + continue; + } + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CharacterMaskPolicy(policyKind, serializedAdditionalRawData, redactionCharacter); + } + + 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(CharacterMaskPolicy)} does not support writing '{options.Format}' format."); + } + } + + CharacterMaskPolicy 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 DeserializeCharacterMaskPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CharacterMaskPolicy)} 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 CharacterMaskPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCharacterMaskPolicy(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/CharacterMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/CharacterMaskPolicy.cs new file mode 100644 index 000000000000..76236702aea5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/CharacterMaskPolicy.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.Documents +{ + /// Represents the policy of redacting with a redaction character. + public partial class CharacterMaskPolicy : BaseRedactionPolicy + { + /// Initializes a new instance of . + public CharacterMaskPolicy() + { + PolicyKind = RedactionPolicyKind.CharacterMask; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + /// 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. + internal CharacterMaskPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData, RedactionCharacter? redactionCharacter) : base(policyKind, serializedAdditionalRawData) + { + RedactionCharacter = redactionCharacter; + } + + /// 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 RedactionCharacter? RedactionCharacter { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Docs/AnalyzeDocumentsClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Docs/AnalyzeDocumentsClient.xml new file mode 100644 index 000000000000..6d93a1777168 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Docs/AnalyzeDocumentsClient.xml @@ -0,0 +1,267 @@ + + + + + +This sample shows how to call GetAnalyzeDocumentsJobStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +Response response = await client.GetAnalyzeDocumentsJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> + + + +This sample shows how to call GetAnalyzeDocumentsJobStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +Response response = client.GetAnalyzeDocumentsJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> + + + +This sample shows how to call GetAnalyzeDocumentsJobStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +Response response = await client.GetAnalyzeDocumentsJobStatusAsync(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 GetAnalyzeDocumentsJobStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +Response response = client.GetAnalyzeDocumentsJobStatus(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 AnalyzeDocumentsSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +AnalyzeDocumentsOperationInput analyzeDocumentOperationInput = new AnalyzeDocumentsOperationInput(new MultiLanguageDocumentInput +{ + Documents = {new MultiLanguageInput("1", new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container/document.txt"), new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container")) + { + Language = "en", + }}, +}, new AnalyzeDocumentsOperationAction[] +{ + new PiiLROTask + { + Parameters = new PiiActionContent + { + PiiCategories = {PiiCategory.Person, PiiCategory.Organization}, + RedactionPolicy = new EntityMaskPolicy(), + }, + Name = "Redact PII Task 1", + } +}) +{ + DisplayName = "Redact PII from documents example", +}; +Operation operation = await client.AnalyzeDocumentsSubmitOperationAsync(WaitUntil.Completed, analyzeDocumentOperationInput); +]]> + + + +This sample shows how to call AnalyzeDocumentsSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +AnalyzeDocumentsOperationInput analyzeDocumentOperationInput = new AnalyzeDocumentsOperationInput(new MultiLanguageDocumentInput +{ + Documents = {new MultiLanguageInput("1", new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container/document.txt"), new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container")) + { + Language = "en", + }}, +}, new AnalyzeDocumentsOperationAction[] +{ + new PiiLROTask + { + Parameters = new PiiActionContent + { + PiiCategories = {PiiCategory.Person, PiiCategory.Organization}, + RedactionPolicy = new EntityMaskPolicy(), + }, + Name = "Redact PII Task 1", + } +}) +{ + DisplayName = "Redact PII from documents example", +}; +Operation operation = client.AnalyzeDocumentsSubmitOperation(WaitUntil.Completed, analyzeDocumentOperationInput); +]]> + + + +This sample shows how to call AnalyzeDocumentsSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redact PII from documents example", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + source = new + { + location = "https://myblob.blob.core.windows.net/Container/document.txt", + kind = "AzureBlob", + }, + target = new + { + location = "https://myblob.blob.core.windows.net/Container", + kind = "AzureBlob", + }, + } + }, + }, + tasks = new object[] + { + new + { + kind = "PiiEntityRecognition", + taskName = "Redact PII Task 1", + parameters = new + { + redactionPolicy = new + { + policyKind = "entityMask", + }, + piiCategories = new object[] + { + "Person", + "Organization" + }, + }, + } + }, +}); +Operation operation = await client.AnalyzeDocumentsSubmitOperationAsync(WaitUntil.Completed, content); +]]> + + + +This sample shows how to call AnalyzeDocumentsSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "Redact PII from documents example", + analysisInput = new + { + documents = new object[] + { + new + { + id = "1", + language = "en", + source = new + { + location = "https://myblob.blob.core.windows.net/Container/document.txt", + kind = "AzureBlob", + }, + target = new + { + location = "https://myblob.blob.core.windows.net/Container", + kind = "AzureBlob", + }, + } + }, + }, + tasks = new object[] + { + new + { + kind = "PiiEntityRecognition", + taskName = "Redact PII Task 1", + parameters = new + { + redactionPolicy = new + { + policyKind = "entityMask", + }, + piiCategories = new object[] + { + "Person", + "Organization" + }, + }, + } + }, +}); +Operation operation = client.AnalyzeDocumentsSubmitOperation(WaitUntil.Completed, content); +]]> + + + +This sample shows how to call AnalyzeDocumentsCancelOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +Operation operation = await client.AnalyzeDocumentsCancelOperationAsync(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> + + + +This sample shows how to call AnalyzeDocumentsCancelOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + +Operation operation = client.AnalyzeDocumentsCancelOperation(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); +]]> + + + \ No newline at end of file diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActionState.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActionState.cs new file mode 100644 index 000000000000..1babaa6d7697 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActionState.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.Documents +{ + /// The status of the task at the mentioned last update time. + public readonly partial struct DocumentActionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentActionState(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 DocumentActionState NotStarted { get; } = new DocumentActionState(NotStartedValue); + /// Running status. + public static DocumentActionState Running { get; } = new DocumentActionState(RunningValue); + /// Succeeded status. + public static DocumentActionState Succeeded { get; } = new DocumentActionState(SucceededValue); + /// Partially completed status. + public static DocumentActionState PartiallyCompleted { get; } = new DocumentActionState(PartiallyCompletedValue); + /// Failed status. + public static DocumentActionState Failed { get; } = new DocumentActionState(FailedValue); + /// Cancelled status. + public static DocumentActionState Cancelled { get; } = new DocumentActionState(CancelledValue); + /// Cancelling status. + public static DocumentActionState Cancelling { get; } = new DocumentActionState(CancellingValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentActionState left, DocumentActionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentActionState left, DocumentActionState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DocumentActionState(string value) => new DocumentActionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentActionState other && Equals(other); + /// + public bool Equals(DocumentActionState 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActions.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActions.Serialization.cs new file mode 100644 index 000000000000..8271d2f2155a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActions.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.Documents +{ + public partial class DocumentActions : 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(DocumentActions)} 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 + } + } + } + + DocumentActions 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(DocumentActions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentActions(document.RootElement, options); + } + + internal static DocumentActions DeserializeDocumentActions(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(AnalyzeDocumentsLROResult.DeserializeAnalyzeDocumentsLROResult(item, options)); + } + items = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentActions( + 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(DocumentActions)} does not support writing '{options.Format}' format."); + } + } + + DocumentActions 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 DeserializeDocumentActions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentActions)} 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 DocumentActions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentActions(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActions.cs new file mode 100644 index 000000000000..39e2c9f8cca6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentActions.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.Documents +{ + /// Container for the tasks status for the LRO job. + public partial class DocumentActions + { + /// + /// 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 DocumentActions(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 documents 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 DocumentActions(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 DocumentActions() + { + } + + /// 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 documents 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentAnalysisDocumentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentAnalysisDocumentResult.Serialization.cs new file mode 100644 index 000000000000..0ef238fa45ca --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentAnalysisDocumentResult.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.Documents +{ + public partial class DocumentAnalysisDocumentResult : 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(DocumentAnalysisDocumentResult)} 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("source"u8); + writer.WriteObjectValue(Source, options); + writer.WritePropertyName("target"u8); + writer.WriteStartArray(); + foreach (var item in Target) + { + 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 + } + } + } + + DocumentAnalysisDocumentResult 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(DocumentAnalysisDocumentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentAnalysisDocumentResult(document.RootElement, options); + } + + internal static DocumentAnalysisDocumentResult DeserializeDocumentAnalysisDocumentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DocumentLocation source = default; + IReadOnlyList target = 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("source"u8)) + { + source = DocumentLocation.DeserializeDocumentLocation(property.Value, options); + continue; + } + if (property.NameEquals("target"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentLocation.DeserializeDocumentLocation(item, options)); + } + target = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentAnalysisDocumentResult( + id, + warnings, + statistics, + source, + target, + 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(DocumentAnalysisDocumentResult)} does not support writing '{options.Format}' format."); + } + } + + DocumentAnalysisDocumentResult 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 DeserializeDocumentAnalysisDocumentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentAnalysisDocumentResult)} 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 DocumentAnalysisDocumentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentAnalysisDocumentResult(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentAnalysisDocumentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentAnalysisDocumentResult.cs new file mode 100644 index 000000000000..36ea33e30b68 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentAnalysisDocumentResult.cs @@ -0,0 +1,125 @@ +// 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.Documents +{ + /// Contains the result object for the processed document. + public partial class DocumentAnalysisDocumentResult + { + /// + /// 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. + /// + /// Location of the input document. + /// 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 . + /// + /// + /// Array of document results generated after the analysis. + /// 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 . + /// + /// , , or is null. + internal DocumentAnalysisDocumentResult(string id, IEnumerable warnings, DocumentLocation source, IEnumerable target) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(source, nameof(source)); + Argument.AssertNotNull(target, nameof(target)); + + Id = id; + Warnings = warnings.ToList(); + Source = source; + Target = target.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. + /// + /// Location of the input document. + /// 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 . + /// + /// + /// Array of document results generated after the analysis. + /// 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 . + /// + /// Keeps track of any properties unknown to the library. + internal DocumentAnalysisDocumentResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, DocumentLocation source, IReadOnlyList target, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Source = source; + Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentAnalysisDocumentResult() + { + } + + /// 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; } + /// + /// Location of the input document. + /// 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 . + /// + public DocumentLocation Source { get; } + /// + /// Array of document results generated after the analysis. + /// 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 . + /// + public IReadOnlyList Target { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocation.Serialization.cs new file mode 100644 index 000000000000..1242c0c3ff07 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocation.Serialization.cs @@ -0,0 +1,133 @@ +// 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.Documents +{ + [PersistableModelProxy(typeof(UnknownDocumentLocation))] + public partial class DocumentLocation : 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(DocumentLocation)} 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 + } + } + } + + DocumentLocation 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(DocumentLocation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentLocation(document.RootElement, options); + } + + internal static DocumentLocation DeserializeDocumentLocation(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 "AzureBlob": return AzureBlobDocumentLocation.DeserializeAzureBlobDocumentLocation(element, options); + } + } + return UnknownDocumentLocation.DeserializeUnknownDocumentLocation(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(DocumentLocation)} does not support writing '{options.Format}' format."); + } + } + + DocumentLocation 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 DeserializeDocumentLocation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentLocation)} 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 DocumentLocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentLocation(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocation.cs new file mode 100644 index 000000000000..037427b3550b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocation.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.Documents +{ + /// + /// Contains the location of the document. + /// 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 . + /// + public abstract partial class DocumentLocation + { + /// + /// 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 DocumentLocation() + { + } + + /// Initializes a new instance of . + /// The kind of the document location. + /// Keeps track of any properties unknown to the library. + internal DocumentLocation(DocumentLocationKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The kind of the document location. + internal DocumentLocationKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocationKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocationKind.cs new file mode 100644 index 000000000000..2115b341f300 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentLocationKind.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.Documents +{ + /// Enumeration of supported document locations. + internal readonly partial struct DocumentLocationKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DocumentLocationKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureBlobValue = "AzureBlob"; + + /// The document is a URL. + public static DocumentLocationKind AzureBlob { get; } = new DocumentLocationKind(AzureBlobValue); + /// Determines if two values are the same. + public static bool operator ==(DocumentLocationKind left, DocumentLocationKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DocumentLocationKind left, DocumentLocationKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DocumentLocationKind(string value) => new DocumentLocationKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DocumentLocationKind other && Equals(other); + /// + public bool Equals(DocumentLocationKind 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentStatistics.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentStatistics.Serialization.cs new file mode 100644 index 000000000000..9a5712454afe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentStatistics.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentStatistics.cs new file mode 100644 index 000000000000..2b4898b67b3c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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 documents 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 documents 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 documents elements recognized in the document. + public int CharactersCount { get; } + /// Number of transactions for the document. + public int TransactionsCount { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentWarning.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentWarning.Serialization.cs new file mode 100644 index 000000000000..8367d1dda3e5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentWarning.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/DocumentWarning.cs new file mode 100644 index 000000000000..2bf26ab264eb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/EntityMaskPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/EntityMaskPolicy.Serialization.cs new file mode 100644 index 000000000000..16b4c6e8fc65 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/EntityMaskPolicy.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.Documents +{ + public partial class EntityMaskPolicy : 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(EntityMaskPolicy)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + EntityMaskPolicy 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(EntityMaskPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityMaskPolicy(document.RootElement, options); + } + + internal static EntityMaskPolicy DeserializeEntityMaskPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionPolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityMaskPolicy(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(EntityMaskPolicy)} does not support writing '{options.Format}' format."); + } + } + + EntityMaskPolicy 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 DeserializeEntityMaskPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityMaskPolicy)} 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 EntityMaskPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityMaskPolicy(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/EntityMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/EntityMaskPolicy.cs new file mode 100644 index 000000000000..1e246c4d5121 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/EntityMaskPolicy.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.Documents +{ + /// Represents the policy of redacting PII with the entity type. + public partial class EntityMaskPolicy : BaseRedactionPolicy + { + /// Initializes a new instance of . + public EntityMaskPolicy() + { + PolicyKind = RedactionPolicyKind.EntityMask; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal EntityMaskPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 000000000000..b622ef4bb69c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationActionContent.cs new file mode 100644 index 000000000000..8594b8a49bbd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 000000000000..4de29612a64e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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; + AnalyzeDocumentsOperationActionKind 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 AnalyzeDocumentsOperationActionKind(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationAction.cs new file mode 100644 index 000000000000..5a8b2b0f150c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// An object representing the task definition for an Extractive Summarization task. + public partial class ExtractiveSummarizationOperationAction : AnalyzeDocumentsOperationAction + { + /// Initializes a new instance of . + public ExtractiveSummarizationOperationAction() + { + Kind = AnalyzeDocumentsOperationActionKind.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, AnalyzeDocumentsOperationActionKind 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 000000000000..711451177f81 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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; + } + AnalyzeDocumentsResult results = default; + DateTimeOffset lastUpdateDateTime = default; + DocumentActionState status = default; + string taskName = default; + AnalyzeDocumentsOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = AnalyzeDocumentsResult.DeserializeAnalyzeDocumentsResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new DocumentActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeDocumentsOperationResultsKind(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationOperationResult.cs new file mode 100644 index 000000000000..63c37d775fa7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// An object representing the results for an Extractive Summarization task. + public partial class ExtractiveSummarizationOperationResult : AnalyzeDocumentsLROResult + { + /// 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 document task. + /// is null. + internal ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, DocumentActionState status, AnalyzeDocumentsResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeDocumentsOperationResultsKind.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 document task. + internal ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, DocumentActionState status, string taskName, AnalyzeDocumentsOperationResultsKind kind, IDictionary serializedAdditionalRawData, AnalyzeDocumentsResult results) : base(lastUpdateDateTime, status, taskName, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal ExtractiveSummarizationOperationResult() + { + } + + /// Results of the document task. + public AnalyzeDocumentsResult Results { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationSortingCriteria.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/ExtractiveSummarizationSortingCriteria.cs new file mode 100644 index 000000000000..b860d166f406 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/InnerErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/InnerErrorCode.cs new file mode 100644 index 000000000000..31129c5ec449 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/InnerErrorModel.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/InnerErrorModel.Serialization.cs new file mode 100644 index 000000000000..8d15ab03b027 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/InnerErrorModel.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/InnerErrorModel.cs new file mode 100644 index 000000000000..d43e45493d49 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/Argument.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..f236086f091a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..d11944f140af --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/ChangeTrackingList.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..9881ee1b94eb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..65d7dae2faad --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/Optional.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..9b0de59ffbac --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..8ec6f6ae5b6e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageDocumentInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageDocumentInput.Serialization.cs new file mode 100644 index 000000000000..60a9ec4d63cd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageDocumentInput.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.Documents +{ + public partial class MultiLanguageDocumentInput : 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(MultiLanguageDocumentInput)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Documents)) + { + 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 + } + } + } + + MultiLanguageDocumentInput 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(MultiLanguageDocumentInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultiLanguageDocumentInput(document.RootElement, options); + } + + internal static MultiLanguageDocumentInput DeserializeMultiLanguageDocumentInput(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 MultiLanguageDocumentInput(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(MultiLanguageDocumentInput)} does not support writing '{options.Format}' format."); + } + } + + MultiLanguageDocumentInput 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 DeserializeMultiLanguageDocumentInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultiLanguageDocumentInput)} 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 MultiLanguageDocumentInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMultiLanguageDocumentInput(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageDocumentInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageDocumentInput.cs new file mode 100644 index 000000000000..0850abbd565a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageDocumentInput.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.Documents +{ + /// Collection of input documents to be analyzed by the service. + public partial class MultiLanguageDocumentInput + { + /// + /// 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 MultiLanguageDocumentInput() + { + Documents = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The input documents to be analyzed. + /// Keeps track of any properties unknown to the library. + internal MultiLanguageDocumentInput(IList documents, IDictionary serializedAdditionalRawData) + { + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The input documents to be analyzed. + public IList Documents { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageInput.Serialization.cs new file mode 100644 index 000000000000..a64c69d31fbd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageInput.Serialization.cs @@ -0,0 +1,169 @@ +// 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.Documents +{ + 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("source"u8); + writer.WriteObjectValue(Source, options); + writer.WritePropertyName("target"u8); + writer.WriteObjectValue(Target, options); + 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; + DocumentLocation source = default; + DocumentLocation target = 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("source"u8)) + { + source = DocumentLocation.DeserializeDocumentLocation(property.Value, options); + continue; + } + if (property.NameEquals("target"u8)) + { + target = DocumentLocation.DeserializeDocumentLocation(property.Value, options); + 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, source, target, 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageInput.cs new file mode 100644 index 000000000000..abc5e6bcf167 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/MultiLanguageInput.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Documents +{ + /// 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 location of the input document to process. + /// 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 . + /// + /// + /// The location where the processed document will be stored. + /// 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 . + /// + /// , or is null. + public MultiLanguageInput(string id, DocumentLocation source, DocumentLocation target) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(source, nameof(source)); + Argument.AssertNotNull(target, nameof(target)); + + Id = id; + Source = source; + Target = target; + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// + /// The location of the input document to process. + /// 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 . + /// + /// + /// The location where the processed document will be stored. + /// 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 . + /// + /// (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. + /// Keeps track of any properties unknown to the library. + internal MultiLanguageInput(string id, DocumentLocation source, DocumentLocation target, string language, IDictionary serializedAdditionalRawData) + { + Id = id; + Source = source; + Target = target; + Language = language; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultiLanguageInput() + { + } + + /// A unique, non-empty document identifier. + public string Id { get; } + /// + /// The location of the input document to process. + /// 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 . + /// + public DocumentLocation Source { get; } + /// + /// The location where the processed document will be stored. + /// 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 . + /// + public DocumentLocation Target { 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. + public string Language { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/NoMaskPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/NoMaskPolicy.Serialization.cs new file mode 100644 index 000000000000..f7c3fa64bb0b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/NoMaskPolicy.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.Documents +{ + public partial class NoMaskPolicy : 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(NoMaskPolicy)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + NoMaskPolicy 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(NoMaskPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNoMaskPolicy(document.RootElement, options); + } + + internal static NoMaskPolicy DeserializeNoMaskPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionPolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NoMaskPolicy(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(NoMaskPolicy)} does not support writing '{options.Format}' format."); + } + } + + NoMaskPolicy 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 DeserializeNoMaskPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NoMaskPolicy)} 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 NoMaskPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNoMaskPolicy(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/NoMaskPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/NoMaskPolicy.cs new file mode 100644 index 000000000000..c5f8aa50b3da --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/NoMaskPolicy.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.Documents +{ + /// Represents the policy of not redacting found PII. + public partial class NoMaskPolicy : BaseRedactionPolicy + { + /// Initializes a new instance of . + public NoMaskPolicy() + { + PolicyKind = RedactionPolicyKind.NoMask; + } + + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal NoMaskPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiActionContent.Serialization.cs new file mode 100644 index 000000000000..76ba90e0cf0d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiActionContent.Serialization.cs @@ -0,0 +1,279 @@ +// 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.Documents +{ + 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(RedactionPolicy)) + { + writer.WritePropertyName("redactionPolicy"u8); + writer.WriteObjectValue(RedactionPolicy, options); + } + if (Optional.IsDefined(ExcludeExtractionData)) + { + writer.WritePropertyName("excludeExtractionData"u8); + writer.WriteBooleanValue(ExcludeExtractionData.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 + } + } + } + + 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; + BaseRedactionPolicy redactionPolicy = default; + bool? excludeExtractionData = 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("redactionPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionPolicy = BaseRedactionPolicy.DeserializeBaseRedactionPolicy(property.Value, options); + continue; + } + if (property.NameEquals("excludeExtractionData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + excludeExtractionData = property.Value.GetBoolean(); + 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(), + redactionPolicy, + excludeExtractionData, + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiActionContent.cs new file mode 100644 index 000000000000..d93ab4e2b06c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiActionContent.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.Documents +{ + /// 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. + /// + /// Redaction policy to be used when redacting from 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 . + /// + /// Boolean to indicate if entities should be excluded from the response json stored in the customer's storage. + /// Keeps track of any properties unknown to the library. + internal PiiActionContent(bool? loggingOptOut, string modelVersion, PiiDomain? domain, IList piiCategories, StringIndexType? stringIndexType, IList excludePiiCategories, BaseRedactionPolicy redactionPolicy, bool? excludeExtractionData, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + Domain = domain; + PiiCategories = piiCategories; + StringIndexType = stringIndexType; + ExcludePiiCategories = excludePiiCategories; + RedactionPolicy = redactionPolicy; + ExcludeExtractionData = excludeExtractionData; + _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; } + /// + /// Redaction policy to be used when redacting from 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 BaseRedactionPolicy RedactionPolicy { get; set; } + /// Boolean to indicate if entities should be excluded from the response json stored in the customer's storage. + public bool? ExcludeExtractionData { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiCategoriesExclude.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiCategoriesExclude.cs new file mode 100644 index 000000000000..26da0bfc7a83 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// (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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiCategory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiCategory.cs new file mode 100644 index 000000000000..2119bb96b16d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// (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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiDomain.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiDomain.cs new file mode 100644 index 000000000000..219eecd43306 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiEntityRecognitionOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiEntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 000000000000..99144941446d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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; + } + AnalyzeDocumentsResult results = default; + DateTimeOffset lastUpdateDateTime = default; + DocumentActionState status = default; + string taskName = default; + AnalyzeDocumentsOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = AnalyzeDocumentsResult.DeserializeAnalyzeDocumentsResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new DocumentActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeDocumentsOperationResultsKind(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiEntityRecognitionOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiEntityRecognitionOperationResult.cs new file mode 100644 index 000000000000..8e4c7f49cb8b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// Contains the PII LRO results. + public partial class PiiEntityRecognitionOperationResult : AnalyzeDocumentsLROResult + { + /// 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 document results. + /// is null. + internal PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, DocumentActionState status, AnalyzeDocumentsResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeDocumentsOperationResultsKind.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 document results. + internal PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, DocumentActionState status, string taskName, AnalyzeDocumentsOperationResultsKind kind, IDictionary serializedAdditionalRawData, AnalyzeDocumentsResult results) : base(lastUpdateDateTime, status, taskName, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal PiiEntityRecognitionOperationResult() + { + } + + /// The list of pii document results. + public AnalyzeDocumentsResult Results { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiLROTask.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiLROTask.Serialization.cs new file mode 100644 index 000000000000..9cfc6cd1ebb3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiLROTask.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.Documents +{ + public partial class PiiLROTask : 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(PiiLROTask)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters, options); + } + } + + PiiLROTask 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(PiiLROTask)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiLROTask(document.RootElement, options); + } + + internal static PiiLROTask DeserializePiiLROTask(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiActionContent parameters = default; + string taskName = default; + AnalyzeDocumentsOperationActionKind 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 AnalyzeDocumentsOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiLROTask(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(PiiLROTask)} does not support writing '{options.Format}' format."); + } + } + + PiiLROTask 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 DeserializePiiLROTask(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiLROTask)} 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 PiiLROTask FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiLROTask(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiLROTask.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiLROTask.cs new file mode 100644 index 000000000000..9a3b2ebff301 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/PiiLROTask.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.Documents +{ + /// Contains the analyze text PIIEntityRecognition LRO task. + public partial class PiiLROTask : AnalyzeDocumentsOperationAction + { + /// Initializes a new instance of . + public PiiLROTask() + { + Kind = AnalyzeDocumentsOperationActionKind.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 PiiLROTask(string name, AnalyzeDocumentsOperationActionKind kind, IDictionary serializedAdditionalRawData, PiiActionContent parameters) : base(name, kind, serializedAdditionalRawData) + { + Parameters = parameters; + } + + /// Pii task parameters. + public PiiActionContent Parameters { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RedactionCharacter.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RedactionCharacter.cs new file mode 100644 index 000000000000..745c91425e38 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RedactionPolicyKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RedactionPolicyKind.cs new file mode 100644 index 000000000000..f40995ea77e4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RedactionPolicyKind.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.Documents +{ + /// Kinds of redaction policies supported. + internal readonly partial struct RedactionPolicyKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedactionPolicyKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoMaskValue = "noMask"; + private const string CharacterMaskValue = "characterMask"; + private const string EntityMaskValue = "entityMask"; + + /// Do not redact detected entities. + public static RedactionPolicyKind NoMask { get; } = new RedactionPolicyKind(NoMaskValue); + /// React detected entities with redaction character. + public static RedactionPolicyKind CharacterMask { get; } = new RedactionPolicyKind(CharacterMaskValue); + /// Redact detected entities with entity type. + public static RedactionPolicyKind EntityMask { get; } = new RedactionPolicyKind(EntityMaskValue); + /// Determines if two values are the same. + public static bool operator ==(RedactionPolicyKind left, RedactionPolicyKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedactionPolicyKind left, RedactionPolicyKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedactionPolicyKind(string value) => new RedactionPolicyKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedactionPolicyKind other && Equals(other); + /// + public bool Equals(RedactionPolicyKind 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RequestStatistics.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RequestStatistics.Serialization.cs new file mode 100644 index 000000000000..47309dba820f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RequestStatistics.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/RequestStatistics.cs new file mode 100644 index 000000000000..412a637869b6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/StringIndexType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/StringIndexType.cs new file mode 100644 index 000000000000..8cea3c841d13 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// Specifies the method used to interpret string offsets. Defaults to documents Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/documents-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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/SummaryLengthBucket.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/SummaryLengthBucket.cs new file mode 100644 index 000000000000..aab181741897 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsLROResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsLROResult.Serialization.cs new file mode 100644 index 000000000000..e14531a2363f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsLROResult.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.Documents +{ + internal partial class UnknownAnalyzeDocumentsLROResult : 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(AnalyzeDocumentsLROResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AnalyzeDocumentsLROResult 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(AnalyzeDocumentsLROResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsLROResult(document.RootElement, options); + } + + internal static UnknownAnalyzeDocumentsLROResult DeserializeUnknownAnalyzeDocumentsLROResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset lastUpdateDateTime = default; + DocumentActionState status = default; + string taskName = default; + AnalyzeDocumentsOperationResultsKind 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 DocumentActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeDocumentsOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeDocumentsLROResult(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(AnalyzeDocumentsLROResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsLROResult 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 DeserializeAnalyzeDocumentsLROResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsLROResult)} 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 UnknownAnalyzeDocumentsLROResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeDocumentsLROResult(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsLROResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsLROResult.cs new file mode 100644 index 000000000000..9c3ef105c17f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsLROResult.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.Documents +{ + /// Unknown version of AnalyzeDocumentsLROResult. + internal partial class UnknownAnalyzeDocumentsLROResult : AnalyzeDocumentsLROResult + { + /// 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 UnknownAnalyzeDocumentsLROResult(DateTimeOffset lastUpdateDateTime, DocumentActionState status, string taskName, AnalyzeDocumentsOperationResultsKind kind, IDictionary serializedAdditionalRawData) : base(lastUpdateDateTime, status, taskName, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeDocumentsLROResult() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsOperationAction.Serialization.cs new file mode 100644 index 000000000000..b344df805d75 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsOperationAction.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.Documents +{ + internal partial class UnknownAnalyzeDocumentsOperationAction : 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(AnalyzeDocumentsOperationAction)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + AnalyzeDocumentsOperationAction 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(AnalyzeDocumentsOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeDocumentsOperationAction(document.RootElement, options); + } + + internal static UnknownAnalyzeDocumentsOperationAction DeserializeUnknownAnalyzeDocumentsOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string taskName = default; + AnalyzeDocumentsOperationActionKind 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 AnalyzeDocumentsOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeDocumentsOperationAction(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(AnalyzeDocumentsOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeDocumentsOperationAction 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 DeserializeAnalyzeDocumentsOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeDocumentsOperationAction)} 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 UnknownAnalyzeDocumentsOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeDocumentsOperationAction(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsOperationAction.cs new file mode 100644 index 000000000000..6210ebe0959d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownAnalyzeDocumentsOperationAction.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.Documents +{ + /// Unknown version of AnalyzeDocumentsOperationAction. + internal partial class UnknownAnalyzeDocumentsOperationAction : AnalyzeDocumentsOperationAction + { + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeDocumentsOperationAction(string name, AnalyzeDocumentsOperationActionKind kind, IDictionary serializedAdditionalRawData) : base(name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeDocumentsOperationAction() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownBaseRedactionPolicy.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownBaseRedactionPolicy.Serialization.cs new file mode 100644 index 000000000000..0d4265acf8c7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownBaseRedactionPolicy.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.Documents +{ + internal partial class UnknownBaseRedactionPolicy : 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(BaseRedactionPolicy)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + BaseRedactionPolicy 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(BaseRedactionPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseRedactionPolicy(document.RootElement, options); + } + + internal static UnknownBaseRedactionPolicy DeserializeUnknownBaseRedactionPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedactionPolicyKind policyKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new RedactionPolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownBaseRedactionPolicy(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(BaseRedactionPolicy)} does not support writing '{options.Format}' format."); + } + } + + BaseRedactionPolicy 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 DeserializeBaseRedactionPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseRedactionPolicy)} 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 UnknownBaseRedactionPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownBaseRedactionPolicy(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownBaseRedactionPolicy.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownBaseRedactionPolicy.cs new file mode 100644 index 000000000000..425e88574313 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownBaseRedactionPolicy.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.Documents +{ + /// Unknown version of BaseRedactionPolicy. + internal partial class UnknownBaseRedactionPolicy : BaseRedactionPolicy + { + /// Initializes a new instance of . + /// The entity RedactionPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownBaseRedactionPolicy(RedactionPolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownBaseRedactionPolicy() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownDocumentLocation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownDocumentLocation.Serialization.cs new file mode 100644 index 000000000000..a92bfc19628f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownDocumentLocation.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.Documents +{ + internal partial class UnknownDocumentLocation : 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(DocumentLocation)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + DocumentLocation 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(DocumentLocation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentLocation(document.RootElement, options); + } + + internal static UnknownDocumentLocation DeserializeUnknownDocumentLocation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DocumentLocationKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new DocumentLocationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownDocumentLocation(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(DocumentLocation)} does not support writing '{options.Format}' format."); + } + } + + DocumentLocation 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 DeserializeDocumentLocation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentLocation)} 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 UnknownDocumentLocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownDocumentLocation(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/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownDocumentLocation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownDocumentLocation.cs new file mode 100644 index 000000000000..71c919bc6a67 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/UnknownDocumentLocation.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.Documents +{ + /// Unknown version of DocumentLocation. + internal partial class UnknownDocumentLocation : DocumentLocation + { + /// Initializes a new instance of . + /// The kind of the document location. + /// Keeps track of any properties unknown to the library. + internal UnknownDocumentLocation(DocumentLocationKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownDocumentLocation() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/WarningCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Generated/WarningCode.cs new file mode 100644 index 000000000000..e2bcfb7ff685 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents +{ + /// 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/cognitivelanguage/Azure.AI.Language.Documents/src/Properties/AssemblyInfo.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..89e00e029ab6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/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.Documents.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/cognitivelanguage/Azure.AI.Language.Documents/tests/Azure.AI.Language.Documents.Tests.csproj b/sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Azure.AI.Language.Documents.Tests.csproj new file mode 100644 index 000000000000..1d375e766d27 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Azure.AI.Language.Documents.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Generated/Samples/Samples_AnalyzeDocumentsClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Generated/Samples/Samples_AnalyzeDocumentsClient.cs new file mode 100644 index 000000000000..73eb22b823ec --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/tests/Generated/Samples/Samples_AnalyzeDocumentsClient.cs @@ -0,0 +1,281 @@ +// 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.Documents.Samples +{ + public partial class Samples_AnalyzeDocumentsClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeDocumentsJobState_GetAnalyzeDocumentsJobStatus_SuccessfulAnalyzeDocumentsJobStatusTaskStatusRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + Response response = client.GetAnalyzeDocumentsJobStatus(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_AnalyzeDocumentsJobState_GetAnalyzeDocumentsJobStatus_SuccessfulAnalyzeDocumentsJobStatusTaskStatusRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + Response response = await client.GetAnalyzeDocumentsJobStatusAsync(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_AnalyzeDocumentsJobState_GetAnalyzeDocumentsJobStatus_SuccessfulAnalyzeDocumentsJobStatusTaskStatusRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + Response response = client.GetAnalyzeDocumentsJobStatus(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeDocumentsJobState_GetAnalyzeDocumentsJobStatus_SuccessfulAnalyzeDocumentsJobStatusTaskStatusRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + Response response = await client.GetAnalyzeDocumentsJobStatusAsync(Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeDocuments_AnalyzeDocumentsSubmitOperation_SuccessfulAnalyzeDocumentsJobsTaskSubmitRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redact PII from documents example", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +source = new +{ +location = "https://myblob.blob.core.windows.net/Container/document.txt", +kind = "AzureBlob", +}, +target = new +{ +location = "https://myblob.blob.core.windows.net/Container", +kind = "AzureBlob", +}, +} + }, + }, + tasks = new object[] + { +new +{ +kind = "PiiEntityRecognition", +taskName = "Redact PII Task 1", +parameters = new +{ +redactionPolicy = new +{ +policyKind = "entityMask", +}, +piiCategories = new object[] +{ +"Person", +"Organization" +}, +}, +} + }, + }); + Operation operation = client.AnalyzeDocumentsSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeDocuments_AnalyzeDocumentsSubmitOperation_SuccessfulAnalyzeDocumentsJobsTaskSubmitRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "Redact PII from documents example", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "1", +language = "en", +source = new +{ +location = "https://myblob.blob.core.windows.net/Container/document.txt", +kind = "AzureBlob", +}, +target = new +{ +location = "https://myblob.blob.core.windows.net/Container", +kind = "AzureBlob", +}, +} + }, + }, + tasks = new object[] + { +new +{ +kind = "PiiEntityRecognition", +taskName = "Redact PII Task 1", +parameters = new +{ +redactionPolicy = new +{ +policyKind = "entityMask", +}, +piiCategories = new object[] +{ +"Person", +"Organization" +}, +}, +} + }, + }); + Operation operation = await client.AnalyzeDocumentsSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeDocuments_AnalyzeDocumentsSubmitOperation_SuccessfulAnalyzeDocumentsJobsTaskSubmitRequest_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + AnalyzeDocumentsOperationInput analyzeDocumentOperationInput = new AnalyzeDocumentsOperationInput(new MultiLanguageDocumentInput + { + Documents = {new MultiLanguageInput("1", new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container/document.txt"), new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container")) +{ +Language = "en", +}}, + }, new AnalyzeDocumentsOperationAction[] + { +new PiiLROTask +{ +Parameters = new PiiActionContent +{ +PiiCategories = {PiiCategory.Person, PiiCategory.Organization}, +RedactionPolicy = new EntityMaskPolicy(), +}, +Name = "Redact PII Task 1", +} + }) + { + DisplayName = "Redact PII from documents example", + }; + Operation operation = client.AnalyzeDocumentsSubmitOperation(WaitUntil.Completed, analyzeDocumentOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeDocuments_AnalyzeDocumentsSubmitOperation_SuccessfulAnalyzeDocumentsJobsTaskSubmitRequest_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + AnalyzeDocumentsOperationInput analyzeDocumentOperationInput = new AnalyzeDocumentsOperationInput(new MultiLanguageDocumentInput + { + Documents = {new MultiLanguageInput("1", new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container/document.txt"), new AzureBlobDocumentLocation("https://myblob.blob.core.windows.net/Container")) +{ +Language = "en", +}}, + }, new AnalyzeDocumentsOperationAction[] + { +new PiiLROTask +{ +Parameters = new PiiActionContent +{ +PiiCategories = {PiiCategory.Person, PiiCategory.Organization}, +RedactionPolicy = new EntityMaskPolicy(), +}, +Name = "Redact PII Task 1", +} + }) + { + DisplayName = "Redact PII from documents example", + }; + Operation operation = await client.AnalyzeDocumentsSubmitOperationAsync(WaitUntil.Completed, analyzeDocumentOperationInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeDocuments_AnalyzeDocumentsCancelOperation_SuccessfulAnalyzeDocumentsJobsCancelRequest() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + Operation operation = client.AnalyzeDocumentsCancelOperation(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeDocuments_AnalyzeDocumentsCancelOperation_SuccessfulAnalyzeDocumentsJobsCancelRequest_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + AnalyzeDocumentsClient client = new AnalyzeDocumentsClient(endpoint, credential); + + Operation operation = await client.AnalyzeDocumentsCancelOperationAsync(WaitUntil.Completed, Guid.Parse("c0f2a446-05d9-48fc-ba8f-3ef4af8d0b18")); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Documents/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Documents/tsp-location.yaml new file mode 100644 index 000000000000..c95266c8b94a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Documents/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/cognitiveservices/Language.AnalyzeDocuments +commit: c6bd27bea6db565d570a019743f836d0925b106d +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Text/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Text/tsp-location.yaml index 687abce7ab3e..ca46722ad701 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Text/tsp-location.yaml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Text/tsp-location.yaml @@ -1,4 +1,4 @@ -repo: azure/azure-rest-api-specs -commit: c2d8026e9d80a1ceb58550646d5f21cffdfb199a directory: specification/cognitiveservices/Language.AnalyzeText - +commit: c6bd27bea6db565d570a019743f836d0925b106d +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders.cs deleted file mode 100644 index b490f7fc74ef..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.TextAnalytics -{ - internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders - { - private readonly Response _response; - public MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders(Response response) - { - _response = response; - } - public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs deleted file mode 100644 index 30df8841a84d..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Core; - -namespace Azure.AI.TextAnalytics -{ - internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders - { - private readonly Response _response; - public MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders(Response response) - { - _response = response; - } - public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders.cs new file mode 100644 index 000000000000..197d5227d5c3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.TextAnalytics +{ + internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders + { + private readonly Response _response; + public MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders(Response response) + { + _response = response; + } + /// The location for monitoring the operation state. + public Uri OperationLocation => _response.Headers.TryGetValue("Operation-Location", out Uri value) ? value : null; + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders.cs new file mode 100644 index 000000000000..4112b2b7e776 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders.cs @@ -0,0 +1,23 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.TextAnalytics +{ + internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders + { + private readonly Response _response; + public MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders(Response response) + { + _response = response; + } + /// The location for monitoring the operation state. + public Uri OperationLocation => _response.Headers.TryGetValue("Operation-Location", out Uri value) ? value : null; + } +} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisRestClient.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestRestClient.cs similarity index 63% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisRestClient.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestRestClient.cs index dd0abe02bafa..35a90b47e14e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisRestClient.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisTestRestClient.cs @@ -15,36 +15,33 @@ namespace Azure.AI.TextAnalytics { - internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisRestClient + internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisTestRestClient { private readonly HttpPipeline _pipeline; - private readonly string _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. internal ClientDiagnostics ClientDiagnostics { get; } - /// Initializes a new instance of MicrosoftCognitiveLanguageServiceTextAnalysisRestClient. + /// Initializes a new instance of MicrosoftCognitiveLanguageServiceTextAnalysisTestRestClient. /// The handler for diagnostic messaging in the client. /// The HTTP pipeline for sending and receiving REST requests and responses. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). /// Api Version. - /// , , or is null. - public MicrosoftCognitiveLanguageServiceTextAnalysisRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2023-04-01") + /// , or is null. + public MicrosoftCognitiveLanguageServiceTextAnalysisTestRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string apiVersion = "2023-04-01") { ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics)); _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); - _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint)); _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion)); } - internal HttpMessage CreateAnalyzeRequest(AnalyzeTextTask body, bool? showStats) + internal HttpMessage CreateAnalyzeRequest(string endpoint, AnalyzeTextTask body, bool? showStats) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.AppendRaw(endpoint, true); uri.AppendRaw("/language", false); uri.AppendPath("/:analyze-text", false); uri.AppendQuery("api-version", _apiVersion, true); @@ -62,19 +59,23 @@ internal HttpMessage CreateAnalyzeRequest(AnalyzeTextTask body, bool? showStats) } /// Request text analysis over a collection of documents. - /// Collection of documents to analyze and a single task to execute. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// 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. - /// Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. - public async Task> AnalyzeAsync(AnalyzeTextTask body, bool? showStats = null, CancellationToken cancellationToken = default) + /// or is null. + public async Task> AnalyzeAsync(string endpoint, AnalyzeTextTask body, bool? showStats = null, CancellationToken cancellationToken = default) { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } if (body == null) { throw new ArgumentNullException(nameof(body)); } - using var message = CreateAnalyzeRequest(body, showStats); + using var message = CreateAnalyzeRequest(endpoint, body, showStats); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -91,19 +92,23 @@ public async Task> AnalyzeAsync(AnalyzeTextTask } /// Request text analysis over a collection of documents. - /// Collection of documents to analyze and a single task to execute. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// 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. - /// Submit a collection of text documents for analysis. Specify a single unique task to be executed immediately. - public Response Analyze(AnalyzeTextTask body, bool? showStats = null, CancellationToken cancellationToken = default) + /// or is null. + public Response Analyze(string endpoint, AnalyzeTextTask body, bool? showStats = null, CancellationToken cancellationToken = default) { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } if (body == null) { throw new ArgumentNullException(nameof(body)); } - using var message = CreateAnalyzeRequest(body, showStats); + using var message = CreateAnalyzeRequest(endpoint, body, showStats); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -119,13 +124,13 @@ public Response Analyze(AnalyzeTextTask body, bool? showS } } - internal HttpMessage CreateAnalyzeBatchSubmitJobRequest(AnalyzeTextJobsInput body) + internal HttpMessage CreateAnalyzeTextSubmitJobRequest(string endpoint, AnalyzeTextJobsInput body) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.AppendRaw(endpoint, true); uri.AppendRaw("/language", false); uri.AppendPath("/analyze-text/jobs", false); uri.AppendQuery("api-version", _apiVersion, true); @@ -138,21 +143,25 @@ internal HttpMessage CreateAnalyzeBatchSubmitJobRequest(AnalyzeTextJobsInput bod return message; } - /// Submit text analysis job. - /// Collection of documents to analyze and one or more tasks to execute. + /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// The to use. /// The cancellation token to use. - /// is null. - /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. - public async Task> AnalyzeBatchSubmitJobAsync(AnalyzeTextJobsInput body, CancellationToken cancellationToken = default) + /// or is null. + public async Task> AnalyzeTextSubmitJobAsync(string endpoint, AnalyzeTextJobsInput body, CancellationToken cancellationToken = default) { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } if (body == null) { throw new ArgumentNullException(nameof(body)); } - using var message = CreateAnalyzeBatchSubmitJobRequest(body); + using var message = CreateAnalyzeTextSubmitJobRequest(endpoint, body); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders(message.Response); + var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders(message.Response); switch (message.Response.Status) { case 202: @@ -162,21 +171,25 @@ public async Task Submit text analysis job. - /// Collection of documents to analyze and one or more tasks to execute. + /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// The to use. /// The cancellation token to use. - /// is null. - /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. - public ResponseWithHeaders AnalyzeBatchSubmitJob(AnalyzeTextJobsInput body, CancellationToken cancellationToken = default) + /// or is null. + public ResponseWithHeaders AnalyzeTextSubmitJob(string endpoint, AnalyzeTextJobsInput body, CancellationToken cancellationToken = default) { + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } if (body == null) { throw new ArgumentNullException(nameof(body)); } - using var message = CreateAnalyzeBatchSubmitJobRequest(body); + using var message = CreateAnalyzeTextSubmitJobRequest(endpoint, body); _pipeline.Send(message, cancellationToken); - var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders(message.Response); + var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextSubmitJobHeaders(message.Response); switch (message.Response.Status) { case 202: @@ -186,13 +199,13 @@ public ResponseWithHeaders Get analysis status and results. - /// Job ID. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// 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 may consist of one or more tasks. Once all tasks are succeeded, the job will transition to the succeeded state and results will be available for each task. - public async Task> AnalyzeBatchJobStatusAsync(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// is null. + /// 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 async Task> AnalyzeTextJobStatusAsync(string endpoint, Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - using var message = CreateAnalyzeBatchJobStatusRequest(jobId, showStats, top, skip); + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + + using var message = CreateAnalyzeTextJobStatusRequest(endpoint, jobId, showStats, top, skip); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -240,15 +260,22 @@ public async Task> AnalyzeBatchJobStatusAsync(Guid } /// Get analysis status and results. - /// Job ID. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// 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 may consist of one or more tasks. Once all tasks are succeeded, the job will transition to the succeeded state and results will be available for each task. - public Response AnalyzeBatchJobStatus(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + /// is null. + /// 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 Response AnalyzeTextJobStatus(string endpoint, Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) { - using var message = CreateAnalyzeBatchJobStatusRequest(jobId, showStats, top, skip); + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + + using var message = CreateAnalyzeTextJobStatusRequest(endpoint, jobId, showStats, top, skip); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -264,13 +291,13 @@ public Response AnalyzeBatchJobStatus(Guid jobId, bool? sho } } - internal HttpMessage CreateAnalyzeBatchCancelJobRequest(Guid jobId) + internal HttpMessage CreateAnalyzeTextCancelJobRequest(string endpoint, Guid jobId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); + uri.AppendRaw(endpoint, true); uri.AppendRaw("/language", false); uri.AppendPath("/analyze-text/jobs/", false); uri.AppendPath(jobId, true); @@ -282,14 +309,20 @@ internal HttpMessage CreateAnalyzeBatchCancelJobRequest(Guid jobId) } /// Cancel a long-running Text Analysis job. - /// Job ID. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// The job ID to cancel. /// The cancellation token to use. - /// Cancel a long-running Text Analysis job. - public async Task> AnalyzeBatchCancelJobAsync(Guid jobId, CancellationToken cancellationToken = default) + /// is null. + public async Task> AnalyzeTextCancelJobAsync(string endpoint, Guid jobId, CancellationToken cancellationToken = default) { - using var message = CreateAnalyzeBatchCancelJobRequest(jobId); + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + + using var message = CreateAnalyzeTextCancelJobRequest(endpoint, jobId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders(message.Response); + var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders(message.Response); switch (message.Response.Status) { case 202: @@ -300,14 +333,20 @@ public async Task Cancel a long-running Text Analysis job. - /// Job ID. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// The job ID to cancel. /// The cancellation token to use. - /// Cancel a long-running Text Analysis job. - public ResponseWithHeaders AnalyzeBatchCancelJob(Guid jobId, CancellationToken cancellationToken = default) + /// is null. + public ResponseWithHeaders AnalyzeTextCancelJob(string endpoint, Guid jobId, CancellationToken cancellationToken = default) { - using var message = CreateAnalyzeBatchCancelJobRequest(jobId); + if (endpoint == null) + { + throw new ArgumentNullException(nameof(endpoint)); + } + + using var message = CreateAnalyzeTextCancelJobRequest(endpoint, jobId); _pipeline.Send(message, cancellationToken); - var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders(message.Response); + var headers = new MicrosoftCognitiveLanguageServiceTextAnalysisTestAnalyzeTextCancelJobHeaders(message.Response); switch (message.Response.Status) { case 202: diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.Serialization.cs index 8065ea334bd2..ddfc97572d5b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class AbstractiveSummarizationLROResult : IUtf8JsonSerializable + internal partial class AbstractiveSummarizationLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static AbstractiveSummarizationLROResult DeserializeAbstractiveSummarizationLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static AbstractiveSummarizationLROResult DeserializeAbstractiveSummariz return null; } AbstractiveSummarizationResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static AbstractiveSummarizationLROResult DeserializeAbstractiveSummariz results = AbstractiveSummarizationResult.DeserializeAbstractiveSummarizationResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new AbstractiveSummarizationLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new AbstractiveSummarizationLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static AbstractiveSummarizationLROResult DeserializeAbstractiveSummariz using var document = JsonDocument.Parse(response.Content); return DeserializeAbstractiveSummarizationLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.cs index fe204112cebe..6852635e6fb5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROResult.cs @@ -13,11 +13,11 @@ namespace Azure.AI.TextAnalytics.Models internal partial class AbstractiveSummarizationLROResult : AnalyzeTextLROResult { /// Initializes a new instance of . - /// - /// - /// An object representing the pre-build summarization results of each document. + /// 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. - public AbstractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status) + internal AbstractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public AbstractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, Text } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// An object representing the pre-build summarization results of each document. - internal AbstractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// Results of the task. + internal AbstractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// An object representing the pre-build summarization results of each document. - public AbstractiveSummarizationResult Results { get; set; } + /// Results of the task. + public AbstractiveSummarizationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.Serialization.cs index 762cb61b5d6e..79998aae4ad3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.Serialization.cs @@ -15,56 +15,21 @@ internal partial class AbstractiveSummarizationLROTask : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("parameters"u8); - writer.WriteObjectValue(Parameters); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters); + } if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static AbstractiveSummarizationLROTask DeserializeAbstractiveSummarizationLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AbstractiveSummarizationTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - parameters = AbstractiveSummarizationTaskParameters.DeserializeAbstractiveSummarizationTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new AbstractiveSummarizationLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new AbstractiveSummarizationLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAbstractiveSummarizationLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.cs index 4ea8a0c30b62..0ec32670637a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationLROTask.cs @@ -5,35 +5,28 @@ #nullable disable -using System; - namespace Azure.AI.TextAnalytics.Models { /// An object representing the task definition for an Abstractive Summarization task. internal partial class AbstractiveSummarizationLROTask : AnalyzeTextLROTask { /// Initializes a new instance of . - /// Supported parameters for the pre-build Abstractive Summarization task. - /// is null. - public AbstractiveSummarizationLROTask(AbstractiveSummarizationTaskParameters parameters) + public AbstractiveSummarizationLROTask() { - Argument.AssertNotNull(parameters, nameof(parameters)); - - Parameters = parameters; Kind = AnalyzeTextLROTaskKind.AbstractiveSummarization; } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for the pre-build Abstractive Summarization task. + /// task name. + /// The kind of task to perform. + /// Parameters for the Abstractive Summarization task. internal AbstractiveSummarizationLROTask(string taskName, AnalyzeTextLROTaskKind kind, AbstractiveSummarizationTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for the pre-build Abstractive Summarization task. + /// Parameters for the Abstractive Summarization task. public AbstractiveSummarizationTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs index ca426f0c177c..dcb3266b801a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs @@ -7,49 +7,21 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class AbstractiveSummarizationResult : IUtf8JsonSerializable + internal partial class AbstractiveSummarizationResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static AbstractiveSummarizationResult DeserializeAbstractiveSummarizationResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; - IList documents = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("errors"u8)) @@ -87,23 +59,15 @@ internal static AbstractiveSummarizationResult DeserializeAbstractiveSummarizati continue; } } - return new AbstractiveSummarizationResult(documents, errors, statistics, modelVersion); + return new AbstractiveSummarizationResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new AbstractiveSummarizationResult FromResponse(Response response) + internal static AbstractiveSummarizationResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeAbstractiveSummarizationResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.cs index 152956060e0f..5194858a8a2f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResult.cs @@ -11,41 +11,45 @@ namespace Azure.AI.TextAnalytics.Models { - /// An object representing the pre-build summarization results of each document. - internal partial class AbstractiveSummarizationResult : AbstractiveSummarizationResultBase + /// An object representing the pre-built Abstractive Summarization results of each document. + internal partial class AbstractiveSummarizationResult { /// Initializes a new instance of . - /// Response by document. /// Errors by document id. /// This field indicates which model is used for scoring. - /// , or is null. - public AbstractiveSummarizationResult(IEnumerable documents, IEnumerable errors, string modelVersion) : base(documents) + /// Response by document. + /// , or is null. + internal AbstractiveSummarizationResult(IEnumerable errors, string modelVersion, IEnumerable documents) { - Argument.AssertNotNull(documents, nameof(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 . - /// 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 which model is used for scoring. - internal AbstractiveSummarizationResult(IList documents, IList errors, TextDocumentBatchStatistics statistics, string modelVersion) : base(documents) + /// Response by document. + internal AbstractiveSummarizationResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { Errors = errors; Statistics = statistics; ModelVersion = modelVersion; + Documents = documents; } /// Errors by document id. - public IList Errors { get; } + public IReadOnlyList Errors { get; } /// if showStats=true was specified in the request this field will contain information about the request payload. - public TextDocumentBatchStatistics Statistics { get; set; } + public TextDocumentBatchStatistics Statistics { get; } /// This field indicates which model is used for scoring. - public string ModelVersion { get; set; } + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.Serialization.cs deleted file mode 100644 index f4487f23d27f..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.Serialization.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class AbstractiveSummarizationResultBase : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - - internal static AbstractiveSummarizationResultBase DeserializeAbstractiveSummarizationResultBase(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList documents = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AbstractiveSummaryDocumentResult.DeserializeAbstractiveSummaryDocumentResult(item)); - } - documents = array; - continue; - } - } - return new AbstractiveSummarizationResultBase(documents); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AbstractiveSummarizationResultBase FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAbstractiveSummarizationResultBase(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.cs deleted file mode 100644 index fff56fe88fb9..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.cs +++ /dev/null @@ -1,37 +0,0 @@ -// 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.TextAnalytics.Models -{ - /// An object representing the summarization results of each document. - internal partial class AbstractiveSummarizationResultBase - { - /// Initializes a new instance of . - /// Response by document. - /// is null. - public AbstractiveSummarizationResultBase(IEnumerable documents) - { - Argument.AssertNotNull(documents, nameof(documents)); - - Documents = documents.ToList(); - } - - /// Initializes a new instance of . - /// Response by document. - internal AbstractiveSummarizationResultBase(IList documents) - { - Documents = documents; - } - - /// Response by document. - public IList Documents { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.Serialization.cs index ad4a424b409a..98063aea1cd0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.Serialization.cs @@ -15,16 +15,16 @@ internal partial class AbstractiveSummarizationTaskParameters : IUtf8JsonSeriali void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } 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); @@ -38,64 +38,8 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteEndObject(); } - internal static AbstractiveSummarizationTaskParameters DeserializeAbstractiveSummarizationTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string modelVersion = default; - bool? loggingOptOut = default; - int? sentenceCount = default; - StringIndexType? stringIndexType = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - 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; - } - } - return new AbstractiveSummarizationTaskParameters(sentenceCount, stringIndexType, modelVersion, loggingOptOut); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new AbstractiveSummarizationTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAbstractiveSummarizationTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.cs index bb6cb9c5ac19..f885117c5a3a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParameters.cs @@ -7,8 +7,8 @@ namespace Azure.AI.TextAnalytics.Models { - /// Supported parameters for the pre-build Abstractive Summarization task. - internal partial class AbstractiveSummarizationTaskParameters : AbstractiveSummarizationTaskParametersBase + /// Supported parameters for the pre-built Abstractive Summarization task. + internal partial class AbstractiveSummarizationTaskParameters { /// Initializes a new instance of . public AbstractiveSummarizationTaskParameters() @@ -16,19 +16,25 @@ public AbstractiveSummarizationTaskParameters() } /// Initializes a new instance of . - /// It controls the approximate number of sentences in the output summaries. - /// 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. - /// - /// - internal AbstractiveSummarizationTaskParameters(int? sentenceCount, StringIndexType? stringIndexType, string modelVersion, bool? loggingOptOut) : base(sentenceCount, stringIndexType) + /// logging opt out. + /// model version. + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + internal AbstractiveSummarizationTaskParameters(bool? loggingOptOut, string modelVersion, int? sentenceCount, StringIndexType? stringIndexType) { - ModelVersion = modelVersion; LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; } - /// Gets or sets the model version. - public string ModelVersion { get; set; } - /// Gets or sets the logging opt out. + /// 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; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.Serialization.cs deleted file mode 100644 index 95e1928f582b..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.Serialization.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class AbstractiveSummarizationTaskParametersBase : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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()); - } - writer.WriteEndObject(); - } - - internal static AbstractiveSummarizationTaskParametersBase DeserializeAbstractiveSummarizationTaskParametersBase(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? sentenceCount = default; - StringIndexType? stringIndexType = default; - 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; - } - } - return new AbstractiveSummarizationTaskParametersBase(sentenceCount, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AbstractiveSummarizationTaskParametersBase FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAbstractiveSummarizationTaskParametersBase(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.cs deleted file mode 100644 index 76ce20ec0146..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// Supported parameters for an Abstractive Summarization task. - internal partial class AbstractiveSummarizationTaskParametersBase - { - /// Initializes a new instance of . - public AbstractiveSummarizationTaskParametersBase() - { - } - - /// Initializes a new instance of . - /// It controls the approximate number of sentences in the output summaries. - /// 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. - internal AbstractiveSummarizationTaskParametersBase(int? sentenceCount, StringIndexType? stringIndexType) - { - SentenceCount = sentenceCount; - StringIndexType = stringIndexType; - } - - /// It controls the approximate number of sentences in the output summaries. - public int? SentenceCount { get; set; } - /// 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 StringIndexType? StringIndexType { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.Serialization.cs index 96123db37230..be77df9d5677 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class AbstractiveSummaryDocumentResult : IUtf8JsonSerializable + internal partial class AbstractiveSummaryDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("summaries"u8); - writer.WriteStartArray(); - foreach (var item in Summaries) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static AbstractiveSummaryDocumentResult DeserializeAbstractiveSummaryDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList summaries = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList summaries = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("summaries"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AbstractiveSummaryInternal.DeserializeAbstractiveSummaryInternal(item)); - } - summaries = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -86,24 +48,26 @@ internal static AbstractiveSummaryDocumentResult DeserializeAbstractiveSummaryDo statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("summaries"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummaryInternal.DeserializeAbstractiveSummaryInternal(item)); + } + summaries = array; + continue; + } } return new AbstractiveSummaryDocumentResult(id, warnings, statistics, summaries); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new AbstractiveSummaryDocumentResult FromResponse(Response response) + internal static AbstractiveSummaryDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeAbstractiveSummaryDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.cs index e376c81074ed..14bf467d7916 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryDocumentResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// An object representing the summarization result of a single document. - internal partial class AbstractiveSummaryDocumentResult : DocumentResult + /// An object representing the pre-built Abstractive Summarization results of each document. + internal partial class AbstractiveSummaryDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. /// Warnings encountered while processing document. /// A list of abstractive summaries. /// , or is null. - public AbstractiveSummaryDocumentResult(string id, IEnumerable warnings, IEnumerable summaries) : base(id, warnings) + internal AbstractiveSummaryDocumentResult(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(); } @@ -33,12 +35,21 @@ public AbstractiveSummaryDocumentResult(string id, IEnumerable /// 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. - internal AbstractiveSummaryDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList summaries) : base(id, warnings, statistics) + internal AbstractiveSummaryDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList summaries) { + Id = id; + Warnings = warnings; + Statistics = statistics; Summaries = summaries; } + /// 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 TextDocumentStatistics? Statistics { get; } /// A list of abstractive summaries. - public IList Summaries { get; } + public IReadOnlyList Summaries { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.Serialization.cs index 082a22ee856f..bfb0c4a28dda 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.Serialization.cs @@ -7,30 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class AbstractiveSummaryInternal : IUtf8JsonSerializable + internal partial class AbstractiveSummaryInternal { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - internal static AbstractiveSummaryInternal DeserializeAbstractiveSummaryInternal(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -38,7 +19,7 @@ internal static AbstractiveSummaryInternal DeserializeAbstractiveSummaryInternal return null; } string text = default; - IList contexts = default; + IReadOnlyList contexts = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("text"u8)) @@ -71,13 +52,5 @@ internal static AbstractiveSummaryInternal FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeAbstractiveSummaryInternal(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.cs index 453d86b5cfa7..8f99b1d672a0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummaryInternal.cs @@ -16,7 +16,7 @@ internal partial class AbstractiveSummaryInternal /// Initializes a new instance of . /// The text of the summary. /// is null. - public AbstractiveSummaryInternal(string text) + internal AbstractiveSummaryInternal(string text) { Argument.AssertNotNull(text, nameof(text)); @@ -27,15 +27,15 @@ public AbstractiveSummaryInternal(string text) /// Initializes a new instance of . /// The text of the summary. /// The context list of the summary. - internal AbstractiveSummaryInternal(string text, IList contexts) + internal AbstractiveSummaryInternal(string text, IReadOnlyList contexts) { Text = text; Contexts = contexts; } /// The text of the summary. - public string Text { get; set; } + public string Text { get; } /// The context list of the summary. - public IList Contexts { get; } + public IReadOnlyList Contexts { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityLinkingInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityLinkingInput.cs index 7d2fe702a155..fb2b23316f24 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityLinkingInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityLinkingInput.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextEntityLinkingInput. + /// Contains the analyze text Entity linking input. internal partial class AnalyzeTextEntityLinkingInput : AnalyzeTextTask { /// Initializes a new instance of . @@ -17,9 +17,9 @@ public AnalyzeTextEntityLinkingInput() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. - /// - /// Supported parameters for an Entity Linking task. + /// The kind of task to perform. + /// Contains the analysis input to be handled by the service. + /// Task parameters. internal AnalyzeTextEntityLinkingInput(AnalyzeTextTaskKind kind, MultiLanguageAnalysisInput analysisInput, EntityLinkingTaskParameters parameters) : base(kind) { AnalysisInput = analysisInput; @@ -27,9 +27,9 @@ internal AnalyzeTextEntityLinkingInput(AnalyzeTextTaskKind kind, MultiLanguageAn Kind = kind; } - /// Gets or sets the analysis input. + /// Contains the analysis input to be handled by the service. public MultiLanguageAnalysisInput AnalysisInput { get; set; } - /// Supported parameters for an Entity Linking task. + /// Task parameters. public EntityLinkingTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityRecognitionInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityRecognitionInput.cs index c69b13f61221..86baa4564984 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityRecognitionInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextEntityRecognitionInput.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextEntityRecognitionInput. + /// The entity recognition analyze text input task request. internal partial class AnalyzeTextEntityRecognitionInput : AnalyzeTextTask { /// Initializes a new instance of . @@ -17,9 +17,9 @@ public AnalyzeTextEntityRecognitionInput() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. - /// - /// Supported parameters for an Entity Recognition task. + /// The kind of task to perform. + /// The input to be analyzed. + /// Task parameters. internal AnalyzeTextEntityRecognitionInput(AnalyzeTextTaskKind kind, MultiLanguageAnalysisInput analysisInput, EntitiesTaskParameters parameters) : base(kind) { AnalysisInput = analysisInput; @@ -27,9 +27,9 @@ internal AnalyzeTextEntityRecognitionInput(AnalyzeTextTaskKind kind, MultiLangua Kind = kind; } - /// Gets or sets the analysis input. + /// The input to be analyzed. public MultiLanguageAnalysisInput AnalysisInput { get; set; } - /// Supported parameters for an Entity Recognition task. + /// Task parameters. public EntitiesTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.Serialization.cs index 692b3289b34a..739b0fe3eb03 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.Serialization.cs @@ -19,32 +19,18 @@ internal static AnalyzeTextJobState DeserializeAnalyzeTextJobState(JsonElement e { return null; } - AnalyzeTasks tasks = default; - TextDocumentBatchStatistics statistics = default; string displayName = default; DateTimeOffset createdDateTime = default; DateTimeOffset? expirationDateTime = default; - string jobId = default; + Guid jobId = default; DateTimeOffset lastUpdatedDateTime = default; TextAnalyticsOperationStatus status = default; IReadOnlyList errors = default; string nextLink = default; + Tasks tasks = default; + TextDocumentBatchStatistics statistics = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("tasks"u8)) - { - tasks = AnalyzeTasks.DeserializeAnalyzeTasks(property.Value); - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value); - continue; - } if (property.NameEquals("displayName"u8)) { displayName = property.Value.GetString(); @@ -66,7 +52,7 @@ internal static AnalyzeTextJobState DeserializeAnalyzeTextJobState(JsonElement e } if (property.NameEquals("jobId"u8)) { - jobId = property.Value.GetString(); + jobId = property.Value.GetGuid(); continue; } if (property.NameEquals("lastUpdatedDateTime"u8)) @@ -98,6 +84,20 @@ internal static AnalyzeTextJobState DeserializeAnalyzeTextJobState(JsonElement e nextLink = property.Value.GetString(); continue; } + if (property.NameEquals("tasks"u8)) + { + tasks = Tasks.DeserializeTasks(property.Value); + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value); + continue; + } } return new AnalyzeTextJobState( displayName, @@ -114,7 +114,7 @@ internal static AnalyzeTextJobState DeserializeAnalyzeTextJobState(JsonElement e /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new AnalyzeTextJobState FromResponse(Response response) + internal static AnalyzeTextJobState FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeAnalyzeTextJobState(document.RootElement); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.cs index 428ef5874f5a..79adb45d42af 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobState.cs @@ -10,43 +10,71 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextJobState. - internal partial class AnalyzeTextJobState : JobState + /// The object containing the analyze job LRO job state. + internal partial class AnalyzeTextJobState { /// Initializes a new instance of . - /// - /// - /// - /// - /// - /// or is null. - internal AnalyzeTextJobState(DateTimeOffset createdDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, TextAnalyticsOperationStatus status, AnalyzeTasks tasks) : base(createdDateTime, jobId, lastUpdatedDateTime, status) + /// Date and time job created. + /// job ID. + /// last updated date and time. + /// status. + /// List of tasks. + /// is null. + internal AnalyzeTextJobState(DateTimeOffset createdDateTime, Guid jobId, DateTimeOffset lastUpdatedDateTime, TextAnalyticsOperationStatus status, Tasks tasks) { - Argument.AssertNotNull(jobId, nameof(jobId)); Argument.AssertNotNull(tasks, nameof(tasks)); + CreatedDateTime = createdDateTime; + JobId = jobId; + LastUpdatedDateTime = lastUpdatedDateTime; + Status = status; + Errors = new ChangeTrackingList(); Tasks = tasks; } /// 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. - internal AnalyzeTextJobState(string displayName, DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, TextAnalyticsOperationStatus status, IReadOnlyList errors, string nextLink, AnalyzeTasks tasks, TextDocumentBatchStatistics statistics) : base(displayName, createdDateTime, expirationDateTime, jobId, lastUpdatedDateTime, status, errors, nextLink) + internal AnalyzeTextJobState(string displayName, DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, Guid jobId, DateTimeOffset lastUpdatedDateTime, TextAnalyticsOperationStatus status, IReadOnlyList errors, string nextLink, Tasks tasks, TextDocumentBatchStatistics statistics) { + DisplayName = displayName; + CreatedDateTime = createdDateTime; + ExpirationDateTime = expirationDateTime; + JobId = jobId; + LastUpdatedDateTime = lastUpdatedDateTime; + Status = status; + Errors = errors; + NextLink = nextLink; Tasks = tasks; Statistics = statistics; } - /// Gets the tasks. - public AnalyzeTasks Tasks { get; } + /// display name. + public string DisplayName { get; } + /// Date and time job created. + public DateTimeOffset CreatedDateTime { get; } + /// Date and time job expires. + public DateTimeOffset? ExpirationDateTime { get; } + /// job ID. + public Guid JobId { get; } + /// last updated date and time. + public DateTimeOffset LastUpdatedDateTime { get; } + /// status. + public TextAnalyticsOperationStatus Status { get; } + /// errors. + public IReadOnlyList Errors { get; } + /// next link. + public string NextLink { get; } + /// List of tasks. + public Tasks Tasks { get; } /// if showStats=true was specified in the request this field will contain information about the request payload. public TextDocumentBatchStatistics Statistics { get; } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.Serialization.cs deleted file mode 100644 index 8e47f382446e..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.Serialization.cs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class AnalyzeTextJobStatistics - { - internal static AnalyzeTextJobStatistics DeserializeAnalyzeTextJobStatistics(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - TextDocumentBatchStatistics statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value); - continue; - } - } - return new AnalyzeTextJobStatistics(statistics); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static AnalyzeTextJobStatistics FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnalyzeTextJobStatistics(document.RootElement); - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.cs deleted file mode 100644 index 572e6b49d676..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// The AnalyzeTextJobStatistics. - internal partial class AnalyzeTextJobStatistics - { - /// Initializes a new instance of . - internal AnalyzeTextJobStatistics() - { - } - - /// Initializes a new instance of . - /// if showStats=true was specified in the request this field will contain information about the request payload. - internal AnalyzeTextJobStatistics(TextDocumentBatchStatistics statistics) - { - Statistics = statistics; - } - - /// if showStats=true was specified in the request this field will contain information about the request payload. - public TextDocumentBatchStatistics Statistics { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobsInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobsInput.cs index 3ac64583a030..00d1d42c9a7e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobsInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobsInput.cs @@ -11,13 +11,13 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextJobsInput. + /// The input object for the analyze text LRO. internal partial class AnalyzeTextJobsInput { /// Initializes a new instance of . - /// + /// Contains the input to be analyzed. /// - /// The set of tasks to execute on the input documents. + /// 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 . /// @@ -32,10 +32,10 @@ public AnalyzeTextJobsInput(MultiLanguageAnalysisInput analysisInput, IEnumerabl } /// Initializes a new instance of . - /// Optional display name for the analysis job. - /// + /// Name for the task. + /// Contains the input to be analyzed. /// - /// The set of tasks to execute on the input documents. + /// 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 . /// @@ -46,12 +46,12 @@ internal AnalyzeTextJobsInput(string displayName, MultiLanguageAnalysisInput ana Tasks = tasks; } - /// Optional display name for the analysis job. + /// Name for the task. public string DisplayName { get; set; } - /// Gets the analysis input. + /// Contains the input to be analyzed. public MultiLanguageAnalysisInput AnalysisInput { get; } /// - /// The set of tasks to execute on the input documents. + /// 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 . /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextKeyPhraseExtractionInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextKeyPhraseExtractionInput.cs index 2d20f0e88bff..bd0f1be828f5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextKeyPhraseExtractionInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextKeyPhraseExtractionInput.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextKeyPhraseExtractionInput. + /// Contains the analyze text KeyPhraseExtraction task input. internal partial class AnalyzeTextKeyPhraseExtractionInput : AnalyzeTextTask { /// Initializes a new instance of . @@ -17,9 +17,9 @@ public AnalyzeTextKeyPhraseExtractionInput() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. - /// - /// Supported parameters for a Key Phrase Extraction task. + /// The kind of task to perform. + /// Contains the input documents. + /// Key phrase extraction task parameters. internal AnalyzeTextKeyPhraseExtractionInput(AnalyzeTextTaskKind kind, MultiLanguageAnalysisInput analysisInput, KeyPhraseTaskParameters parameters) : base(kind) { AnalysisInput = analysisInput; @@ -27,9 +27,9 @@ internal AnalyzeTextKeyPhraseExtractionInput(AnalyzeTextTaskKind kind, MultiLang Kind = kind; } - /// Gets or sets the analysis input. + /// Contains the input documents. public MultiLanguageAnalysisInput AnalysisInput { get; set; } - /// Supported parameters for a Key Phrase Extraction task. + /// Key phrase extraction task parameters. public KeyPhraseTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.Serialization.cs index 172f74e44e05..10020485c219 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.Serialization.cs @@ -6,29 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class AnalyzeTextLROResult : IUtf8JsonSerializable + internal partial class AnalyzeTextLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static AnalyzeTextLROResult DeserializeAnalyzeTextLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -57,18 +39,10 @@ internal static AnalyzeTextLROResult DeserializeAnalyzeTextLROResult(JsonElement /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new AnalyzeTextLROResult FromResponse(Response response) + internal static AnalyzeTextLROResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeAnalyzeTextLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.cs index 9b13dfe853c8..af6765a5c0b8 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResult.cs @@ -10,33 +10,41 @@ namespace Azure.AI.TextAnalytics.Models { /// - /// The AnalyzeTextLROResult. + /// 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 . /// - internal abstract partial class AnalyzeTextLROResult : TaskState + internal abstract partial class AnalyzeTextLROResult { /// Initializes a new instance of . - /// - /// - protected AnalyzeTextLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status) : base(lastUpdateDateTime, status) + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + protected AnalyzeTextLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status) { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - internal AnalyzeTextLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName) : base(lastUpdateDateTime, status) + /// 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. + internal AnalyzeTextLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind) { - Kind = kind; + LastUpdateDateTime = lastUpdateDateTime; + Status = status; TaskName = taskName; + Kind = kind; } - /// Enumeration of supported Text Analysis long-running operation task results. + /// 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 TextAnalyticsOperationStatus Status { get; } + /// task name. + public string TaskName { get; } + /// Kind of the task. internal AnalyzeTextLROResultsKind Kind { get; set; } - /// Gets or sets the task name. - public string TaskName { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResultsKind.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResultsKind.cs index 2e377d47db46..bb4fe4fed170 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResultsKind.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROResultsKind.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// Enumeration of supported Text Analysis long-running operation task results. + /// The kind of the response object returned by the analyze-text long running task. internal readonly partial struct AnalyzeTextLROResultsKind : IEquatable { private readonly string _value; @@ -28,33 +28,33 @@ public AnalyzeTextLROResultsKind(string value) private const string KeyPhraseExtractionLROResultsValue = "KeyPhraseExtractionLROResults"; private const string EntityLinkingLROResultsValue = "EntityLinkingLROResults"; private const string HealthcareLROResultsValue = "HealthcareLROResults"; - private const string ExtractiveSummarizationLROResultsValue = "ExtractiveSummarizationLROResults"; private const string CustomEntityRecognitionLROResultsValue = "CustomEntityRecognitionLROResults"; private const string CustomSingleLabelClassificationLROResultsValue = "CustomSingleLabelClassificationLROResults"; private const string CustomMultiLabelClassificationLROResultsValue = "CustomMultiLabelClassificationLROResults"; + private const string ExtractiveSummarizationLROResultsValue = "ExtractiveSummarizationLROResults"; private const string AbstractiveSummarizationLROResultsValue = "AbstractiveSummarizationLROResults"; - /// SentimentAnalysisLROResults. + /// Sentiment analysis LRO results. public static AnalyzeTextLROResultsKind SentimentAnalysisLROResults { get; } = new AnalyzeTextLROResultsKind(SentimentAnalysisLROResultsValue); - /// EntityRecognitionLROResults. + /// Entity recognition LRO results. public static AnalyzeTextLROResultsKind EntityRecognitionLROResults { get; } = new AnalyzeTextLROResultsKind(EntityRecognitionLROResultsValue); - /// PiiEntityRecognitionLROResults. + /// PII entity recognition LRO results. public static AnalyzeTextLROResultsKind PiiEntityRecognitionLROResults { get; } = new AnalyzeTextLROResultsKind(PiiEntityRecognitionLROResultsValue); - /// KeyPhraseExtractionLROResults. + /// Key phrase extraction LRO results. public static AnalyzeTextLROResultsKind KeyPhraseExtractionLROResults { get; } = new AnalyzeTextLROResultsKind(KeyPhraseExtractionLROResultsValue); - /// EntityLinkingLROResults. + /// Entity linking LRO results. public static AnalyzeTextLROResultsKind EntityLinkingLROResults { get; } = new AnalyzeTextLROResultsKind(EntityLinkingLROResultsValue); - /// HealthcareLROResults. + /// Healthcare LRO results. public static AnalyzeTextLROResultsKind HealthcareLROResults { get; } = new AnalyzeTextLROResultsKind(HealthcareLROResultsValue); - /// ExtractiveSummarizationLROResults. - public static AnalyzeTextLROResultsKind ExtractiveSummarizationLROResults { get; } = new AnalyzeTextLROResultsKind(ExtractiveSummarizationLROResultsValue); - /// CustomEntityRecognitionLROResults. + /// Custom entity recognition LRO results. public static AnalyzeTextLROResultsKind CustomEntityRecognitionLROResults { get; } = new AnalyzeTextLROResultsKind(CustomEntityRecognitionLROResultsValue); - /// CustomSingleLabelClassificationLROResults. + /// Custom single label classification LRO results. public static AnalyzeTextLROResultsKind CustomSingleLabelClassificationLROResults { get; } = new AnalyzeTextLROResultsKind(CustomSingleLabelClassificationLROResultsValue); - /// CustomMultiLabelClassificationLROResults. + /// Custom multi label classification LRO results. public static AnalyzeTextLROResultsKind CustomMultiLabelClassificationLROResults { get; } = new AnalyzeTextLROResultsKind(CustomMultiLabelClassificationLROResultsValue); - /// AbstractiveSummarizationLROResults. + /// Extractive summarization LRO results. + public static AnalyzeTextLROResultsKind ExtractiveSummarizationLROResults { get; } = new AnalyzeTextLROResultsKind(ExtractiveSummarizationLROResultsValue); + /// Abstractive summarization LRO results. public static AnalyzeTextLROResultsKind AbstractiveSummarizationLROResults { get; } = new AnalyzeTextLROResultsKind(AbstractiveSummarizationLROResultsValue); /// Determines if two values are the same. public static bool operator ==(AnalyzeTextLROResultsKind left, AnalyzeTextLROResultsKind right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.Serialization.cs index 2c5b75b3c680..240f09b20935 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.Serialization.cs @@ -15,52 +15,18 @@ internal partial class AnalyzeTextLROTask : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static AnalyzeTextLROTask DeserializeAnalyzeTextLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - if (element.TryGetProperty("kind", out JsonElement discriminator)) - { - switch (discriminator.GetString()) - { - case "AbstractiveSummarization": return AbstractiveSummarizationLROTask.DeserializeAbstractiveSummarizationLROTask(element); - case "CustomEntityRecognition": return CustomEntitiesLROTask.DeserializeCustomEntitiesLROTask(element); - case "CustomMultiLabelClassification": return CustomMultiLabelClassificationLROTask.DeserializeCustomMultiLabelClassificationLROTask(element); - case "CustomSingleLabelClassification": return CustomSingleLabelClassificationLROTask.DeserializeCustomSingleLabelClassificationLROTask(element); - case "EntityLinking": return EntityLinkingLROTask.DeserializeEntityLinkingLROTask(element); - case "EntityRecognition": return EntitiesLROTask.DeserializeEntitiesLROTask(element); - case "ExtractiveSummarization": return ExtractiveSummarizationLROTask.DeserializeExtractiveSummarizationLROTask(element); - case "Healthcare": return HealthcareLROTask.DeserializeHealthcareLROTask(element); - case "KeyPhraseExtraction": return KeyPhraseLROTask.DeserializeKeyPhraseLROTask(element); - case "PiiEntityRecognition": return PiiLROTask.DeserializePiiLROTask(element); - case "SentimentAnalysis": return SentimentAnalysisLROTask.DeserializeSentimentAnalysisLROTask(element); - } - } - return UnknownAnalyzeTextLROTask.DeserializeUnknownAnalyzeTextLROTask(element); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new AnalyzeTextLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeAnalyzeTextLROTask(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.cs index f4cf6ac92b0c..b0b4872d36ba 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTask.cs @@ -8,11 +8,11 @@ namespace Azure.AI.TextAnalytics.Models { /// - /// The AnalyzeTextLROTask. + /// 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 . /// - internal abstract partial class AnalyzeTextLROTask : TaskIdentifier + internal abstract partial class AnalyzeTextLROTask { /// Initializes a new instance of . protected AnalyzeTextLROTask() @@ -20,14 +20,17 @@ protected AnalyzeTextLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - internal AnalyzeTextLROTask(string taskName, AnalyzeTextLROTaskKind kind) : base(taskName) + /// task name. + /// The kind of task to perform. + internal AnalyzeTextLROTask(string taskName, AnalyzeTextLROTaskKind kind) { + TaskName = taskName; Kind = kind; } - /// Enumeration of supported long-running Text Analysis tasks. + /// task name. + public string TaskName { get; set; } + /// The kind of task to perform. internal AnalyzeTextLROTaskKind Kind { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTaskKind.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTaskKind.cs index 1c982ec66517..88d427b59293 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTaskKind.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLROTaskKind.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// Enumeration of supported long-running Text Analysis tasks. + /// The kind of the long running analyze text tasks supported. internal readonly partial struct AnalyzeTextLROTaskKind : IEquatable { private readonly string _value; @@ -28,33 +28,33 @@ public AnalyzeTextLROTaskKind(string value) private const string KeyPhraseExtractionValue = "KeyPhraseExtraction"; private const string EntityLinkingValue = "EntityLinking"; private const string HealthcareValue = "Healthcare"; - private const string ExtractiveSummarizationValue = "ExtractiveSummarization"; 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"; - /// SentimentAnalysis. + /// Sentiment analysis task. public static AnalyzeTextLROTaskKind SentimentAnalysis { get; } = new AnalyzeTextLROTaskKind(SentimentAnalysisValue); - /// EntityRecognition. + /// Entity recognition task. public static AnalyzeTextLROTaskKind EntityRecognition { get; } = new AnalyzeTextLROTaskKind(EntityRecognitionValue); - /// PiiEntityRecognition. + /// PII entity recognition task. public static AnalyzeTextLROTaskKind PiiEntityRecognition { get; } = new AnalyzeTextLROTaskKind(PiiEntityRecognitionValue); - /// KeyPhraseExtraction. + /// Key phrase extraction task. public static AnalyzeTextLROTaskKind KeyPhraseExtraction { get; } = new AnalyzeTextLROTaskKind(KeyPhraseExtractionValue); - /// EntityLinking. + /// Entity linking task. public static AnalyzeTextLROTaskKind EntityLinking { get; } = new AnalyzeTextLROTaskKind(EntityLinkingValue); - /// Healthcare. + /// Healthcare task. public static AnalyzeTextLROTaskKind Healthcare { get; } = new AnalyzeTextLROTaskKind(HealthcareValue); - /// ExtractiveSummarization. - public static AnalyzeTextLROTaskKind ExtractiveSummarization { get; } = new AnalyzeTextLROTaskKind(ExtractiveSummarizationValue); - /// CustomEntityRecognition. + /// Custom entity recognition task. public static AnalyzeTextLROTaskKind CustomEntityRecognition { get; } = new AnalyzeTextLROTaskKind(CustomEntityRecognitionValue); - /// CustomSingleLabelClassification. + /// Custom single label classification task. public static AnalyzeTextLROTaskKind CustomSingleLabelClassification { get; } = new AnalyzeTextLROTaskKind(CustomSingleLabelClassificationValue); - /// CustomMultiLabelClassification. + /// Custom multi label classification task. public static AnalyzeTextLROTaskKind CustomMultiLabelClassification { get; } = new AnalyzeTextLROTaskKind(CustomMultiLabelClassificationValue); - /// AbstractiveSummarization. + /// Extractive summarization task. + public static AnalyzeTextLROTaskKind ExtractiveSummarization { get; } = new AnalyzeTextLROTaskKind(ExtractiveSummarizationValue); + /// Abstractive summarization task. public static AnalyzeTextLROTaskKind AbstractiveSummarization { get; } = new AnalyzeTextLROTaskKind(AbstractiveSummarizationValue); /// Determines if two values are the same. public static bool operator ==(AnalyzeTextLROTaskKind left, AnalyzeTextLROTaskKind right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLanguageDetectionInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLanguageDetectionInput.cs index f465872cfd6b..c7c94e6c21bc 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLanguageDetectionInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextLanguageDetectionInput.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextLanguageDetectionInput. + /// Contains the language detection document analysis task input. internal partial class AnalyzeTextLanguageDetectionInput : AnalyzeTextTask { /// Initializes a new instance of . @@ -17,9 +17,9 @@ public AnalyzeTextLanguageDetectionInput() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. - /// - /// Supported parameters for a Language Detection task. + /// The kind of task to perform. + /// Documents to be analyzed. + /// task parameters. internal AnalyzeTextLanguageDetectionInput(AnalyzeTextTaskKind kind, LanguageDetectionAnalysisInput analysisInput, LanguageDetectionTaskParameters parameters) : base(kind) { AnalysisInput = analysisInput; @@ -27,9 +27,9 @@ internal AnalyzeTextLanguageDetectionInput(AnalyzeTextTaskKind kind, LanguageDet Kind = kind; } - /// Gets or sets the analysis input. + /// Documents to be analyzed. public LanguageDetectionAnalysisInput AnalysisInput { get; set; } - /// Supported parameters for a Language Detection task. + /// task parameters. public LanguageDetectionTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextPiiEntitiesRecognitionInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextPiiEntitiesRecognitionInput.cs index 9ca27601cd3d..8ab523ead415 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextPiiEntitiesRecognitionInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextPiiEntitiesRecognitionInput.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextPiiEntitiesRecognitionInput. + /// Contains the analyze text PIIEntityRecognition task input. internal partial class AnalyzeTextPiiEntitiesRecognitionInput : AnalyzeTextTask { /// Initializes a new instance of . @@ -17,9 +17,9 @@ public AnalyzeTextPiiEntitiesRecognitionInput() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. - /// - /// Supported parameters for a PII Entities Recognition task. + /// The kind of task to perform. + /// Contains the input documents. + /// Pii task parameters. internal AnalyzeTextPiiEntitiesRecognitionInput(AnalyzeTextTaskKind kind, MultiLanguageAnalysisInput analysisInput, PiiTaskParameters parameters) : base(kind) { AnalysisInput = analysisInput; @@ -27,9 +27,9 @@ internal AnalyzeTextPiiEntitiesRecognitionInput(AnalyzeTextTaskKind kind, MultiL Kind = kind; } - /// Gets or sets the analysis input. + /// Contains the input documents. public MultiLanguageAnalysisInput AnalysisInput { get; set; } - /// Supported parameters for a PII Entities Recognition task. + /// Pii task parameters. public PiiTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextSentimentAnalysisInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextSentimentAnalysisInput.cs index 7e6748a86667..ff57e2ba2077 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextSentimentAnalysisInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextSentimentAnalysisInput.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The AnalyzeTextSentimentAnalysisInput. + /// Contains the analyze text SentimentAnalysis task input. internal partial class AnalyzeTextSentimentAnalysisInput : AnalyzeTextTask { /// Initializes a new instance of . @@ -17,9 +17,9 @@ public AnalyzeTextSentimentAnalysisInput() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. - /// - /// Supported parameters for a Sentiment Analysis task. + /// The kind of task to perform. + /// Contains the input documents. + /// Sentiment Analysis task parameters. internal AnalyzeTextSentimentAnalysisInput(AnalyzeTextTaskKind kind, MultiLanguageAnalysisInput analysisInput, SentimentAnalysisTaskParameters parameters) : base(kind) { AnalysisInput = analysisInput; @@ -27,9 +27,9 @@ internal AnalyzeTextSentimentAnalysisInput(AnalyzeTextTaskKind kind, MultiLangua Kind = kind; } - /// Gets or sets the analysis input. + /// Contains the input documents. public MultiLanguageAnalysisInput AnalysisInput { get; set; } - /// Supported parameters for a Sentiment Analysis task. + /// Sentiment Analysis task parameters. public SentimentAnalysisTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTask.cs index 8e42d2693178..f1c814675e96 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTask.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// - /// The AnalyzeTextTask. + /// 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 . /// @@ -20,13 +20,13 @@ public AnalyzeTextTask() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis tasks. + /// The kind of task to perform. internal AnalyzeTextTask(AnalyzeTextTaskKind kind) { Kind = kind; } - /// Enumeration of supported Text Analysis tasks. + /// The kind of task to perform. internal AnalyzeTextTaskKind Kind { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskKind.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskKind.cs index 43db54d0b992..ca1c5d6392fb 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskKind.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskKind.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// Enumeration of supported Text Analysis tasks. + /// The kind of the analyze-text tasks supported. internal readonly partial struct AnalyzeTextTaskKind : IEquatable { private readonly string _value; @@ -29,17 +29,17 @@ public AnalyzeTextTaskKind(string value) private const string LanguageDetectionValue = "LanguageDetection"; private const string EntityLinkingValue = "EntityLinking"; - /// SentimentAnalysis. + /// Sentiment analysis task. public static AnalyzeTextTaskKind SentimentAnalysis { get; } = new AnalyzeTextTaskKind(SentimentAnalysisValue); - /// EntityRecognition. + /// Entity recognition task. public static AnalyzeTextTaskKind EntityRecognition { get; } = new AnalyzeTextTaskKind(EntityRecognitionValue); - /// PiiEntityRecognition. + /// PII entity recognition task. public static AnalyzeTextTaskKind PiiEntityRecognition { get; } = new AnalyzeTextTaskKind(PiiEntityRecognitionValue); - /// KeyPhraseExtraction. + /// Key phrase extraction task. public static AnalyzeTextTaskKind KeyPhraseExtraction { get; } = new AnalyzeTextTaskKind(KeyPhraseExtractionValue); - /// LanguageDetection. + /// Language detection task. public static AnalyzeTextTaskKind LanguageDetection { get; } = new AnalyzeTextTaskKind(LanguageDetectionValue); - /// EntityLinking. + /// Entity linking task. public static AnalyzeTextTaskKind EntityLinking { get; } = new AnalyzeTextTaskKind(EntityLinkingValue); /// Determines if two values are the same. public static bool operator ==(AnalyzeTextTaskKind left, AnalyzeTextTaskKind right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResult.cs index 57e6017ac79f..95e4c82205c0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResult.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// - /// The AnalyzeTextTaskResult. + /// 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 . /// @@ -20,13 +20,13 @@ internal AnalyzeTextTaskResult() } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. + /// The kind of task result. internal AnalyzeTextTaskResult(AnalyzeTextTaskResultsKind kind) { Kind = kind; } - /// Enumeration of supported Text Analysis task results. + /// The kind of task result. internal AnalyzeTextTaskResultsKind Kind { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResultsKind.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResultsKind.cs index 5ce829a83773..1bf6a0b45253 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResultsKind.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextTaskResultsKind.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// Enumeration of supported Text Analysis task results. + /// The kind of the response object returned by the analyze-text task. internal readonly partial struct AnalyzeTextTaskResultsKind : IEquatable { private readonly string _value; @@ -29,17 +29,17 @@ public AnalyzeTextTaskResultsKind(string value) private const string LanguageDetectionResultsValue = "LanguageDetectionResults"; private const string EntityLinkingResultsValue = "EntityLinkingResults"; - /// SentimentAnalysisResults. + /// Sentiment analysis results. public static AnalyzeTextTaskResultsKind SentimentAnalysisResults { get; } = new AnalyzeTextTaskResultsKind(SentimentAnalysisResultsValue); - /// EntityRecognitionResults. + /// Entity recognition results. public static AnalyzeTextTaskResultsKind EntityRecognitionResults { get; } = new AnalyzeTextTaskResultsKind(EntityRecognitionResultsValue); - /// PiiEntityRecognitionResults. + /// PII entity recognition results. public static AnalyzeTextTaskResultsKind PiiEntityRecognitionResults { get; } = new AnalyzeTextTaskResultsKind(PiiEntityRecognitionResultsValue); - /// KeyPhraseExtractionResults. + /// Key phrase extraction results. public static AnalyzeTextTaskResultsKind KeyPhraseExtractionResults { get; } = new AnalyzeTextTaskResultsKind(KeyPhraseExtractionResultsValue); - /// LanguageDetectionResults. + /// Language detection results. public static AnalyzeTextTaskResultsKind LanguageDetectionResults { get; } = new AnalyzeTextTaskResultsKind(LanguageDetectionResultsValue); - /// EntityLinkingResults. + /// Entity linking results. public static AnalyzeTextTaskResultsKind EntityLinkingResults { get; } = new AnalyzeTextTaskResultsKind(EntityLinkingResultsValue); /// Determines if two values are the same. public static bool operator ==(AnalyzeTextTaskResultsKind left, AnalyzeTextTaskResultsKind right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.Serialization.cs index 8e077790f9fe..f6b52192e1e0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class ClassificationDocumentResult : IUtf8JsonSerializable + internal partial class ClassificationDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("class"u8); - writer.WriteStartArray(); - foreach (var item in Class) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static ClassificationDocumentResult DeserializeClassificationDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList @class = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList @class = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("class"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ClassificationResult.DeserializeClassificationResult(item)); - } - @class = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -86,24 +48,26 @@ internal static ClassificationDocumentResult DeserializeClassificationDocumentRe statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("class"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationResult.DeserializeClassificationResult(item)); + } + @class = array; + continue; + } } return new ClassificationDocumentResult(id, warnings, statistics, @class); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new ClassificationDocumentResult FromResponse(Response response) + internal static ClassificationDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeClassificationDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.cs index 1678bd2cfc09..d97a10e8541a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationDocumentResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The ClassificationDocumentResult. - internal partial class ClassificationDocumentResult : DocumentResult + /// Contains the classification doc result for the task. + internal partial class ClassificationDocumentResult { /// 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. - public ClassificationDocumentResult(string id, IEnumerable warnings, IEnumerable @class) : base(id, warnings) + internal ClassificationDocumentResult(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(); } @@ -32,13 +34,22 @@ public ClassificationDocumentResult(string id, IEnumerable warn /// 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. - /// - internal ClassificationDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList @class) : base(id, warnings, statistics) + /// Contains the classification doc results for all docs. + internal ClassificationDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList @class) { + Id = id; + Warnings = warnings; + Statistics = statistics; Class = @class; } - /// Gets the class. - public IList Class { get; } + /// 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 TextDocumentStatistics? Statistics { get; } + /// Contains the classification doc results for all docs. + public IReadOnlyList Class { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.Serialization.cs index 887396cf4ffd..afa7d5a21e91 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class ClassificationResult : IUtf8JsonSerializable + internal partial class ClassificationResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("category"u8); - writer.WriteStringValue(Category); - writer.WritePropertyName("confidenceScore"u8); - writer.WriteNumberValue(ConfidenceScore); - writer.WriteEndObject(); - } - internal static ClassificationResult DeserializeClassificationResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,13 +42,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.cs index b5a2e06b412d..4146061ccfb0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ClassificationResult.cs @@ -9,14 +9,14 @@ namespace Azure.AI.TextAnalytics.Models { - /// The ClassificationResult. + /// Contains the classification result. internal partial class ClassificationResult { /// Initializes a new instance of . /// Classification type. /// Confidence score between 0 and 1 of the recognized class. /// is null. - public ClassificationResult(string category, double confidenceScore) + internal ClassificationResult(string category, double confidenceScore) { Argument.AssertNotNull(category, nameof(category)); @@ -25,8 +25,8 @@ public ClassificationResult(string category, double confidenceScore) } /// Classification type. - public string Category { get; set; } + public string Category { get; } /// Confidence score between 0 and 1 of the recognized class. - public double ConfidenceScore { get; set; } + public double ConfidenceScore { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.Serialization.cs index 9b0ce67417b8..03b12b16e234 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static CustomEntitiesLROTask DeserializeCustomEntitiesLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CustomEntitiesTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = CustomEntitiesTaskParameters.DeserializeCustomEntitiesTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new CustomEntitiesLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomEntitiesLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomEntitiesLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.cs index d73f078a2417..1810f3396d58 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesLROTask.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// Use custom models to ease the process of information extraction from unstructured documents like contracts or financial documents. + /// Contains the custom text LRO task. internal partial class CustomEntitiesLROTask : AnalyzeTextLROTask { /// Initializes a new instance of . @@ -17,16 +17,16 @@ public CustomEntitiesLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a Custom Entities task. + /// task name. + /// The kind of task to perform. + /// task parameters. internal CustomEntitiesLROTask(string taskName, AnalyzeTextLROTaskKind kind, CustomEntitiesTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a Custom Entities task. + /// task parameters. public CustomEntitiesTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.Serialization.cs index c04d465f9fdb..f3c06cefdebe 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.Serialization.cs @@ -7,64 +7,24 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomEntitiesResult : IUtf8JsonSerializable + internal partial class CustomEntitiesResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("projectName"u8); - writer.WriteStringValue(ProjectName); - writer.WritePropertyName("deploymentName"u8); - writer.WriteStringValue(DeploymentName); - writer.WriteEndObject(); - } - internal static CustomEntitiesResult DeserializeCustomEntitiesResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string projectName = default; string deploymentName = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(CustomEntitiesResultDocumentsItem.DeserializeCustomEntitiesResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -94,24 +54,26 @@ internal static CustomEntitiesResult DeserializeCustomEntitiesResult(JsonElement deploymentName = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntitiesDocumentResult.DeserializeEntitiesDocumentResult(item)); + } + documents = array; + continue; + } } return new CustomEntitiesResult(errors, statistics, projectName, deploymentName, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new CustomEntitiesResult FromResponse(Response response) + internal static CustomEntitiesResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeCustomEntitiesResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.cs index 15ab3b54fa0a..bb78519c545f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResult.cs @@ -11,22 +11,25 @@ namespace Azure.AI.TextAnalytics.Models { - /// The CustomEntitiesResult. - internal partial class CustomEntitiesResult : CustomResult + /// Contains the list of detected custom entities result for the documents. + internal partial class CustomEntitiesResult { /// 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. + /// Enumeration of the document results. /// , , or is null. - public CustomEntitiesResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) : base(errors, projectName, deploymentName) + internal CustomEntitiesResult(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(); } @@ -35,13 +38,25 @@ public CustomEntitiesResult(IEnumerable errors, string projectNam /// 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. - internal CustomEntitiesResult(IList errors, TextDocumentBatchStatistics statistics, string projectName, string deploymentName, IList documents) : base(errors, statistics, projectName, deploymentName) + /// Enumeration of the document results. + internal CustomEntitiesResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; Documents = documents; } - /// Response by document. - public IList 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 TextDocumentBatchStatistics 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. + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.Serialization.cs deleted file mode 100644 index 7c60eff8c1ec..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class CustomEntitiesResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static CustomEntitiesResultDocumentsItem DeserializeCustomEntitiesResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList entities = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Entity.DeserializeEntity(item)); - } - entities = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new CustomEntitiesResultDocumentsItem(id, warnings, statistics, entities); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomEntitiesResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomEntitiesResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.cs deleted file mode 100644 index 1f7ee1e77323..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The CustomEntitiesResultDocumentsItem. - internal partial class CustomEntitiesResultDocumentsItem : EntitiesDocumentResult - { - /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// Warnings encountered while processing document. - /// Recognized entities in the document. - /// , or is null. - public CustomEntitiesResultDocumentsItem(string id, IEnumerable warnings, IEnumerable entities) : base(id, warnings, entities) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(entities, nameof(entities)); - } - - /// 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. - internal CustomEntitiesResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, IList entities) : base(id, warnings, statistics, entities) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs index 40777b221ac6..60458c2c9dda 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.Serialization.cs @@ -15,77 +15,25 @@ internal partial class CustomEntitiesTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(StringIndexType)) + if (Optional.IsDefined(LoggingOptOut)) { - writer.WritePropertyName("stringIndexType"u8); - writer.WriteStringValue(StringIndexType.Value.ToString()); + 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(LoggingOptOut)) + if (Optional.IsDefined(StringIndexType)) { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); } writer.WriteEndObject(); } - internal static CustomEntitiesTaskParameters DeserializeCustomEntitiesTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StringIndexType? stringIndexType = default; - string projectName = default; - string deploymentName = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("stringIndexType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stringIndexType = new StringIndexType(property.Value.GetString()); - continue; - } - if (property.NameEquals("projectName"u8)) - { - projectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deploymentName"u8)) - { - deploymentName = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new CustomEntitiesTaskParameters(loggingOptOut, projectName, deploymentName, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomEntitiesTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomEntitiesTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs index 3a0ec5b6f939..d62acc282801 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesTaskParameters.cs @@ -10,29 +10,41 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Custom Entities task. - internal partial class CustomEntitiesTaskParameters : CustomTaskParameters + internal partial class CustomEntitiesTaskParameters { /// 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 CustomEntitiesTaskParameters(string projectName, string deploymentName) : base(projectName, deploymentName) + public CustomEntitiesTaskParameters(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. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. - internal CustomEntitiesTaskParameters(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType) : base(loggingOptOut, projectName, deploymentName) + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + internal CustomEntitiesTaskParameters(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; StringIndexType = stringIndexType; } - /// 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. + /// 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.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.Serialization.cs index 76b88c03a180..4d2474f8c796 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomEntityRecognitionLROResult : IUtf8JsonSerializable + internal partial class CustomEntityRecognitionLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static CustomEntityRecognitionLROResult DeserializeCustomEntityRecognitionLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static CustomEntityRecognitionLROResult DeserializeCustomEntityRecognit return null; } CustomEntitiesResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static CustomEntityRecognitionLROResult DeserializeCustomEntityRecognit results = CustomEntitiesResult.DeserializeCustomEntitiesResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new CustomEntityRecognitionLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new CustomEntityRecognitionLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static CustomEntityRecognitionLROResult DeserializeCustomEntityRecognit using var document = JsonDocument.Parse(response.Content); return DeserializeCustomEntityRecognitionLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.cs index 20e2905df3c9..141052d365b4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntityRecognitionLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The CustomEntityRecognitionLROResult. + /// Contains the custom entity recognition job result. internal partial class CustomEntityRecognitionLROResult : AnalyzeTextLROResult { /// 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. - public CustomEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, CustomEntitiesResult results) : base(lastUpdateDateTime, status) + internal CustomEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, CustomEntitiesResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public CustomEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextA } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal CustomEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, CustomEntitiesResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// List of results. + internal CustomEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, CustomEntitiesResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public CustomEntitiesResult Results { get; set; } + /// List of results. + public CustomEntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.Serialization.cs index ab31af97a514..b2f9b0ced541 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.Serialization.cs @@ -7,64 +7,24 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomLabelClassificationResult : IUtf8JsonSerializable + internal partial class CustomLabelClassificationResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("projectName"u8); - writer.WriteStringValue(ProjectName); - writer.WritePropertyName("deploymentName"u8); - writer.WriteStringValue(DeploymentName); - writer.WriteEndObject(); - } - internal static CustomLabelClassificationResult DeserializeCustomLabelClassificationResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string projectName = default; string deploymentName = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(CustomLabelClassificationResultDocumentsItem.DeserializeCustomLabelClassificationResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -94,24 +54,26 @@ internal static CustomLabelClassificationResult DeserializeCustomLabelClassifica deploymentName = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationDocumentResult.DeserializeClassificationDocumentResult(item)); + } + documents = array; + continue; + } } return new CustomLabelClassificationResult(errors, statistics, projectName, deploymentName, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new CustomLabelClassificationResult FromResponse(Response response) + internal static CustomLabelClassificationResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeCustomLabelClassificationResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.cs index bfdacca2e077..2c49360ac640 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResult.cs @@ -11,8 +11,8 @@ namespace Azure.AI.TextAnalytics.Models { - /// The CustomLabelClassificationResult. - internal partial class CustomLabelClassificationResult : CustomResult + /// Contains the custom label classification results. + internal partial class CustomLabelClassificationResult { /// Initializes a new instance of . /// Errors by document id. @@ -20,13 +20,16 @@ internal partial class CustomLabelClassificationResult : CustomResult /// This field indicates the deployment name for the model. /// Response by document. /// , , or is null. - public CustomLabelClassificationResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) : base(errors, projectName, deploymentName) + internal CustomLabelClassificationResult(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(); } @@ -36,12 +39,24 @@ public CustomLabelClassificationResult(IEnumerable errors, string /// This field indicates the project name for the model. /// This field indicates the deployment name for the model. /// Response by document. - internal CustomLabelClassificationResult(IList errors, TextDocumentBatchStatistics statistics, string projectName, string deploymentName, IList documents) : base(errors, statistics, projectName, deploymentName) + internal CustomLabelClassificationResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; Documents = documents; } + /// 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 TextDocumentBatchStatistics 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 IList Documents { get; } + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.Serialization.cs deleted file mode 100644 index 3264b5bd572a..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class CustomLabelClassificationResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("class"u8); - writer.WriteStartArray(); - foreach (var item in Class) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static CustomLabelClassificationResultDocumentsItem DeserializeCustomLabelClassificationResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList @class = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("class"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ClassificationResult.DeserializeClassificationResult(item)); - } - @class = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new CustomLabelClassificationResultDocumentsItem(id, warnings, statistics, @class); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomLabelClassificationResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomLabelClassificationResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.cs deleted file mode 100644 index d6e4dba54305..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The CustomLabelClassificationResultDocumentsItem. - internal partial class CustomLabelClassificationResultDocumentsItem : ClassificationDocumentResult - { - /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// Warnings encountered while processing document. - /// - /// , or is null. - public CustomLabelClassificationResultDocumentsItem(string id, IEnumerable warnings, IEnumerable @class) : base(id, warnings, @class) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(@class, nameof(@class)); - } - - /// 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. - /// - internal CustomLabelClassificationResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, IList @class) : base(id, warnings, statistics, @class) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.Serialization.cs index 3a230bf197fd..82fa022a91bc 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomMultiLabelClassificationLROResult : IUtf8JsonSerializable + internal partial class CustomMultiLabelClassificationLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static CustomMultiLabelClassificationLROResult DeserializeCustomMultiLabelClassificationLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static CustomMultiLabelClassificationLROResult DeserializeCustomMultiLa return null; } CustomLabelClassificationResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static CustomMultiLabelClassificationLROResult DeserializeCustomMultiLa results = CustomLabelClassificationResult.DeserializeCustomLabelClassificationResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new CustomMultiLabelClassificationLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new CustomMultiLabelClassificationLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static CustomMultiLabelClassificationLROResult DeserializeCustomMultiLa using var document = JsonDocument.Parse(response.Content); return DeserializeCustomMultiLabelClassificationLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.cs index 82bb78d8afb7..1ed6d8e6739f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The CustomMultiLabelClassificationLROResult. + /// Contains the custom multi label classification job result. internal partial class CustomMultiLabelClassificationLROResult : AnalyzeTextLROResult { /// 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. - public CustomMultiLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status) + internal CustomMultiLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public CustomMultiLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal CustomMultiLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// List of results. + internal CustomMultiLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public CustomLabelClassificationResult Results { get; set; } + /// List of results. + public CustomLabelClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.Serialization.cs index bc605fd22f8a..5f2483051590 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static CustomMultiLabelClassificationLROTask DeserializeCustomMultiLabelClassificationLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CustomMultiLabelClassificationTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = CustomMultiLabelClassificationTaskParameters.DeserializeCustomMultiLabelClassificationTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new CustomMultiLabelClassificationLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomMultiLabelClassificationLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomMultiLabelClassificationLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.cs index 2e7299ab1eb1..13bfe4043af5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationLROTask.cs @@ -17,16 +17,16 @@ public CustomMultiLabelClassificationLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a Custom Multi Classification task. + /// task name. + /// The kind of task to perform. + /// Task parameters. internal CustomMultiLabelClassificationLROTask(string taskName, AnalyzeTextLROTaskKind kind, CustomMultiLabelClassificationTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a Custom Multi Classification task. + /// Task parameters. public CustomMultiLabelClassificationTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.Serialization.cs index 6a086149be67..21f4aff09933 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.Serialization.cs @@ -15,62 +15,20 @@ internal partial class CustomMultiLabelClassificationTaskParameters : IUtf8JsonS void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("projectName"u8); - writer.WriteStringValue(ProjectName); - writer.WritePropertyName("deploymentName"u8); - writer.WriteStringValue(DeploymentName); 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); writer.WriteEndObject(); } - internal static CustomMultiLabelClassificationTaskParameters DeserializeCustomMultiLabelClassificationTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string projectName = default; - string deploymentName = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("projectName"u8)) - { - projectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deploymentName"u8)) - { - deploymentName = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new CustomMultiLabelClassificationTaskParameters(loggingOptOut, projectName, deploymentName); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomMultiLabelClassificationTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomMultiLabelClassificationTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.cs index 8448c6711b87..aa140b75ddb0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomMultiLabelClassificationTaskParameters.cs @@ -10,24 +10,37 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Custom Multi Classification task. - internal partial class CustomMultiLabelClassificationTaskParameters : CustomTaskParameters + internal partial class CustomMultiLabelClassificationTaskParameters { /// 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 CustomMultiLabelClassificationTaskParameters(string projectName, string deploymentName) : base(projectName, deploymentName) + public CustomMultiLabelClassificationTaskParameters(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. - internal CustomMultiLabelClassificationTaskParameters(bool? loggingOptOut, string projectName, string deploymentName) : base(loggingOptOut, projectName, deploymentName) + internal CustomMultiLabelClassificationTaskParameters(bool? loggingOptOut, string projectName, string deploymentName) { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; } + + /// 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.TextAnalytics/src/Generated/Models/CustomResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.Serialization.cs deleted file mode 100644 index 4eae7cf20593..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.Serialization.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class CustomResult : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("projectName"u8); - writer.WriteStringValue(ProjectName); - writer.WritePropertyName("deploymentName"u8); - writer.WriteStringValue(DeploymentName); - writer.WriteEndObject(); - } - - internal static CustomResult DeserializeCustomResult(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList errors = default; - TextDocumentBatchStatistics statistics = default; - string projectName = default; - string deploymentName = default; - 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)); - } - errors = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value); - continue; - } - if (property.NameEquals("projectName"u8)) - { - projectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deploymentName"u8)) - { - deploymentName = property.Value.GetString(); - continue; - } - } - return new CustomResult(errors, statistics, projectName, deploymentName); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CustomResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.cs deleted file mode 100644 index bcdc468a4039..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.cs +++ /dev/null @@ -1,55 +0,0 @@ -// 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.TextAnalytics.Models -{ - /// The CustomResult. - internal partial class CustomResult - { - /// 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. - /// , or is null. - public CustomResult(IEnumerable errors, string projectName, string deploymentName) - { - Argument.AssertNotNull(errors, nameof(errors)); - Argument.AssertNotNull(projectName, nameof(projectName)); - Argument.AssertNotNull(deploymentName, nameof(deploymentName)); - - Errors = errors.ToList(); - ProjectName = projectName; - DeploymentName = deploymentName; - } - - /// 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. - internal CustomResult(IList errors, TextDocumentBatchStatistics statistics, string projectName, string deploymentName) - { - Errors = errors; - Statistics = statistics; - ProjectName = projectName; - DeploymentName = deploymentName; - } - - /// Errors by document id. - public IList Errors { get; } - /// if showStats=true was specified in the request this field will contain information about the request payload. - public TextDocumentBatchStatistics Statistics { get; set; } - /// This field indicates the project name for the model. - public string ProjectName { get; set; } - /// This field indicates the deployment name for the model. - public string DeploymentName { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.Serialization.cs index 416a259e924a..1d2d28c23738 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class CustomSingleLabelClassificationLROResult : IUtf8JsonSerializable + internal partial class CustomSingleLabelClassificationLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static CustomSingleLabelClassificationLROResult DeserializeCustomSingleLabelClassificationLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static CustomSingleLabelClassificationLROResult DeserializeCustomSingle return null; } CustomLabelClassificationResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static CustomSingleLabelClassificationLROResult DeserializeCustomSingle results = CustomLabelClassificationResult.DeserializeCustomLabelClassificationResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new CustomSingleLabelClassificationLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new CustomSingleLabelClassificationLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static CustomSingleLabelClassificationLROResult DeserializeCustomSingle using var document = JsonDocument.Parse(response.Content); return DeserializeCustomSingleLabelClassificationLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.cs index cda6ff4c5749..ed3c064d05e1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The CustomSingleLabelClassificationLROResult. + /// Contains the custom single label classification job result. internal partial class CustomSingleLabelClassificationLROResult : AnalyzeTextLROResult { /// 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. - public CustomSingleLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status) + internal CustomSingleLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public CustomSingleLabelClassificationLROResult(DateTimeOffset lastUpdateDateTim } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal CustomSingleLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// List of results. + internal CustomSingleLabelClassificationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, CustomLabelClassificationResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public CustomLabelClassificationResult Results { get; set; } + /// List of results. + public CustomLabelClassificationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.Serialization.cs index 5851ddde45b8..ae6a9f9494f6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static CustomSingleLabelClassificationLROTask DeserializeCustomSingleLabelClassificationLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CustomSingleLabelClassificationTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = CustomSingleLabelClassificationTaskParameters.DeserializeCustomSingleLabelClassificationTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new CustomSingleLabelClassificationLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomSingleLabelClassificationLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomSingleLabelClassificationLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.cs index 0a833c789cfd..ffbe5846ef39 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationLROTask.cs @@ -17,16 +17,16 @@ public CustomSingleLabelClassificationLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a Custom Single Classification task. + /// task name. + /// The kind of task to perform. + /// Task parameters. internal CustomSingleLabelClassificationLROTask(string taskName, AnalyzeTextLROTaskKind kind, CustomSingleLabelClassificationTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a Custom Single Classification task. + /// Task parameters. public CustomSingleLabelClassificationTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.Serialization.cs index cdf62c6e4787..fe5cce2737f5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.Serialization.cs @@ -15,62 +15,20 @@ internal partial class CustomSingleLabelClassificationTaskParameters : IUtf8Json void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("projectName"u8); - writer.WriteStringValue(ProjectName); - writer.WritePropertyName("deploymentName"u8); - writer.WriteStringValue(DeploymentName); 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); writer.WriteEndObject(); } - internal static CustomSingleLabelClassificationTaskParameters DeserializeCustomSingleLabelClassificationTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string projectName = default; - string deploymentName = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("projectName"u8)) - { - projectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deploymentName"u8)) - { - deploymentName = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new CustomSingleLabelClassificationTaskParameters(loggingOptOut, projectName, deploymentName); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomSingleLabelClassificationTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomSingleLabelClassificationTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.cs index 5ad3caa9b5e1..60a1b50c5008 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomSingleLabelClassificationTaskParameters.cs @@ -10,24 +10,37 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Custom Single Classification task. - internal partial class CustomSingleLabelClassificationTaskParameters : CustomTaskParameters + internal partial class CustomSingleLabelClassificationTaskParameters { /// 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 CustomSingleLabelClassificationTaskParameters(string projectName, string deploymentName) : base(projectName, deploymentName) + public CustomSingleLabelClassificationTaskParameters(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. - internal CustomSingleLabelClassificationTaskParameters(bool? loggingOptOut, string projectName, string deploymentName) : base(loggingOptOut, projectName, deploymentName) + internal CustomSingleLabelClassificationTaskParameters(bool? loggingOptOut, string projectName, string deploymentName) { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; } + + /// 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.TextAnalytics/src/Generated/Models/CustomTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.Serialization.cs deleted file mode 100644 index 967295e415ce..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.Serialization.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class CustomTaskParameters : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("projectName"u8); - writer.WriteStringValue(ProjectName); - writer.WritePropertyName("deploymentName"u8); - writer.WriteStringValue(DeploymentName); - if (Optional.IsDefined(LoggingOptOut)) - { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); - } - writer.WriteEndObject(); - } - - internal static CustomTaskParameters DeserializeCustomTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string projectName = default; - string deploymentName = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("projectName"u8)) - { - projectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("deploymentName"u8)) - { - deploymentName = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new CustomTaskParameters(loggingOptOut, projectName, deploymentName); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new CustomTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeCustomTaskParameters(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.cs deleted file mode 100644 index bc9c41960071..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.AI.TextAnalytics.Models -{ - /// Parameters object for a text analysis task using custom models. - internal partial class CustomTaskParameters : TaskParameters - { - /// 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 CustomTaskParameters(string projectName, string deploymentName) - { - Argument.AssertNotNull(projectName, nameof(projectName)); - Argument.AssertNotNull(deploymentName, nameof(deploymentName)); - - ProjectName = projectName; - DeploymentName = deploymentName; - } - - /// Initializes a new instance of . - /// - /// This field indicates the project name for the model. - /// This field indicates the deployment name for the model. - internal CustomTaskParameters(bool? loggingOptOut, string projectName, string deploymentName) : base(loggingOptOut) - { - ProjectName = projectName; - DeploymentName = deploymentName; - } - - /// This field indicates the project name for the model. - public string ProjectName { get; set; } - /// This field indicates the deployment name for the model. - public string DeploymentName { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.Serialization.cs index 907d468fc915..62f10a11ee8f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.Serialization.cs @@ -6,38 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial struct DetectedLanguageInternal : IUtf8JsonSerializable + internal partial struct DetectedLanguageInternal { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Name != null) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - else - { - writer.WriteNull("name"); - } - if (Iso6391Name != null) - { - writer.WritePropertyName("iso6391Name"u8); - writer.WriteStringValue(Iso6391Name); - } - else - { - writer.WriteNull("iso6391Name"); - } - writer.WritePropertyName("confidenceScore"u8); - writer.WriteNumberValue(ConfidenceScore); - writer.WriteEndObject(); - } - internal static DetectedLanguageInternal DeserializeDetectedLanguageInternal(JsonElement element) { string name = default; @@ -81,13 +54,5 @@ internal static DetectedLanguageInternal FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeDetectedLanguageInternal(document.RootElement); } - - /// Convert into a . - internal RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.cs index 7881fab4631f..bd39e70ea226 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DetectedLanguageInternal.cs @@ -7,14 +7,14 @@ namespace Azure.AI.TextAnalytics.Models { - /// The DetectedLanguage. + /// Contains the details of the detected language for the text. internal readonly partial struct DetectedLanguageInternal { /// 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. - public DetectedLanguageInternal(string name, string iso6391Name, double confidenceScore) + internal DetectedLanguageInternal(string name, string iso6391Name, double confidenceScore) { Name = name; Iso6391Name = iso6391Name; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.Serialization.cs index 5a8a5f890169..b236f5376c22 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class DocumentError : IUtf8JsonSerializable + internal partial class DocumentError { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error); - writer.WriteEndObject(); - } - internal static DocumentError DeserializeDocumentError(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,13 +42,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.cs index d08c02aca622..ae27fc1421b0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentError.cs @@ -16,7 +16,7 @@ internal partial class DocumentError /// The ID of the input document. /// Error encountered. /// or is null. - public DocumentError(string id, Error error) + internal DocumentError(string id, Error error) { Argument.AssertNotNull(id, nameof(id)); Argument.AssertNotNull(error, nameof(error)); @@ -26,8 +26,8 @@ public DocumentError(string id, Error error) } /// The ID of the input document. - public string Id { get; set; } + public string Id { get; } /// Error encountered. - public Error Error { get; set; } + public Error Error { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.Serialization.cs deleted file mode 100644 index ab1f75b85616..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.Serialization.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class DocumentResult : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static DocumentResult DeserializeDocumentResult(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new DocumentResult(id, warnings, statistics); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static DocumentResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeDocumentResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.cs deleted file mode 100644 index f71905d52301..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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.TextAnalytics.Models -{ - /// The DocumentResult. - internal partial class DocumentResult - { - /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// Warnings encountered while processing document. - /// or is null. - public DocumentResult(string id, IEnumerable warnings) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - - Id = id; - Warnings = warnings.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. - internal DocumentResult(string id, IList warnings, TextDocumentStatistics? statistics) - { - Id = id; - Warnings = warnings; - Statistics = statistics; - } - - /// Unique, non-empty document identifier. - public string Id { get; set; } - /// Warnings encountered while processing document. - public IList Warnings { get; } - /// if showStats=true was specified in the request this field will contain information about the document payload. - public TextDocumentStatistics? Statistics { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.Serialization.cs index 695cc18c09b8..eef9309cc49f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.Serialization.cs @@ -6,27 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class DocumentWarning : IUtf8JsonSerializable + internal partial class DocumentWarning { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code.ToSerialString()); - writer.WritePropertyName("message"u8); - writer.WriteStringValue(Message); - if (Optional.IsDefined(TargetRef)) - { - writer.WritePropertyName("targetRef"u8); - writer.WriteStringValue(TargetRef); - } - writer.WriteEndObject(); - } - internal static DocumentWarning DeserializeDocumentWarning(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -64,13 +48,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.cs index 08ed64bfb069..46a47e245769 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentWarning.cs @@ -9,14 +9,14 @@ namespace Azure.AI.TextAnalytics.Models { - /// The DocumentWarning. + /// Contains the warnings object with warnings encountered for the processed document. internal partial class DocumentWarning { /// Initializes a new instance of . - /// Error code. + /// Warning code. /// Warning message. /// is null. - public DocumentWarning(WarningCodeValue code, string message) + internal DocumentWarning(WarningCodeValue code, string message) { Argument.AssertNotNull(message, nameof(message)); @@ -25,7 +25,7 @@ public DocumentWarning(WarningCodeValue code, string message) } /// Initializes a new instance of . - /// Error code. + /// Warning code. /// Warning message. /// A JSON pointer reference indicating the target object. internal DocumentWarning(WarningCodeValue code, string message, string targetRef) @@ -35,11 +35,11 @@ internal DocumentWarning(WarningCodeValue code, string message, string targetRef TargetRef = targetRef; } - /// Error code. - public WarningCodeValue Code { get; set; } + /// Warning code. + public WarningCodeValue Code { get; } /// Warning message. - public string Message { get; set; } + public string Message { get; } /// A JSON pointer reference indicating the target object. - public string TargetRef { get; set; } + public string TargetRef { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.Serialization.cs index 20e261b3eaf5..2553dc54bb6d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class EntitiesDocumentResult : IUtf8JsonSerializable + internal partial class EntitiesDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static EntitiesDocumentResult DeserializeEntitiesDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList entities = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList entities = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Entity.DeserializeEntity(item)); - } - entities = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -86,24 +48,26 @@ internal static EntitiesDocumentResult DeserializeEntitiesDocumentResult(JsonEle statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Entity.DeserializeEntity(item)); + } + entities = array; + continue; + } } return new EntitiesDocumentResult(id, warnings, statistics, entities); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new EntitiesDocumentResult FromResponse(Response response) + internal static EntitiesDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeEntitiesDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.cs index f22a185b0dcc..fda0d735c6f9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesDocumentResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntitiesDocumentResult. - internal partial class EntitiesDocumentResult : DocumentResult + /// Contains the entity recognition task result for the document. + internal partial class EntitiesDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. /// Warnings encountered while processing document. /// Recognized entities in the document. /// , or is null. - public EntitiesDocumentResult(string id, IEnumerable warnings, IEnumerable entities) : base(id, warnings) + internal EntitiesDocumentResult(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(); } @@ -33,12 +35,21 @@ public EntitiesDocumentResult(string id, IEnumerable warnings, /// 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. - internal EntitiesDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList entities) : base(id, warnings, statistics) + internal EntitiesDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList entities) { + Id = id; + Warnings = warnings; + Statistics = statistics; Entities = entities; } + /// 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 TextDocumentStatistics? Statistics { get; } /// Recognized entities in the document. - public IList Entities { get; } + public IReadOnlyList Entities { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.Serialization.cs index b1f9460e1b15..d9c5f18d07a6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static EntitiesLROTask DeserializeEntitiesLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - EntitiesTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = EntitiesTaskParameters.DeserializeEntitiesTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new EntitiesLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new EntitiesLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEntitiesLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.cs index d76d674c8b45..e3586da5e418 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesLROTask.cs @@ -17,16 +17,16 @@ public EntitiesLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for an Entity Recognition task. + /// task name. + /// The kind of task to perform. + /// Task parameters. internal EntitiesLROTask(string taskName, AnalyzeTextLROTaskKind kind, EntitiesTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for an Entity Recognition task. + /// Task parameters. public EntitiesTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.Serialization.cs index c523cbe7254c..933fa9ca4956 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class EntitiesResult : IUtf8JsonSerializable + internal partial class EntitiesResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static EntitiesResult DeserializeEntitiesResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(EntitiesResultDocumentsItem.DeserializeEntitiesResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static EntitiesResult DeserializeEntitiesResult(JsonElement element) modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntitiesDocumentResult.DeserializeEntitiesDocumentResult(item)); + } + documents = array; + continue; + } } return new EntitiesResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new EntitiesResult FromResponse(Response response) + internal static EntitiesResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeEntitiesResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.cs index 04e60c035971..79f802f2225e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntitiesResult. - internal partial class EntitiesResult : PreBuiltResult + /// Contains the entity recognition task result. + internal partial class EntitiesResult { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. /// Response by document. /// , or is null. - public EntitiesResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + 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(); } @@ -33,12 +35,21 @@ public EntitiesResult(IEnumerable errors, string modelVersion, IE /// 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. - internal EntitiesResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + internal EntitiesResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } + /// 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 TextDocumentBatchStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } /// Response by document. - public IList Documents { get; } + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.Serialization.cs deleted file mode 100644 index 0364b8511622..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class EntitiesResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static EntitiesResultDocumentsItem DeserializeEntitiesResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList entities = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Entity.DeserializeEntity(item)); - } - entities = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new EntitiesResultDocumentsItem(id, warnings, statistics, entities); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new EntitiesResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEntitiesResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.cs deleted file mode 100644 index b279a33ced9e..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The EntitiesResultDocumentsItem. - internal partial class EntitiesResultDocumentsItem : EntitiesDocumentResult - { - /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// Warnings encountered while processing document. - /// Recognized entities in the document. - /// , or is null. - public EntitiesResultDocumentsItem(string id, IEnumerable warnings, IEnumerable entities) : base(id, warnings, entities) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(entities, nameof(entities)); - } - - /// 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. - internal EntitiesResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, IList entities) : base(id, warnings, statistics, entities) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.Serialization.cs index 8fe20d837dd5..6ce2677b229e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.Serialization.cs @@ -15,72 +15,26 @@ internal partial class EntitiesTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(StringIndexType)) + if (Optional.IsDefined(LoggingOptOut)) { - writer.WritePropertyName("stringIndexType"u8); - writer.WriteStringValue(StringIndexType.Value.ToString()); + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); } if (Optional.IsDefined(ModelVersion)) { writer.WritePropertyName("modelVersion"u8); writer.WriteStringValue(ModelVersion); } - if (Optional.IsDefined(LoggingOptOut)) + if (Optional.IsDefined(StringIndexType)) { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); } writer.WriteEndObject(); } - internal static EntitiesTaskParameters DeserializeEntitiesTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StringIndexType? stringIndexType = default; - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("stringIndexType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stringIndexType = new StringIndexType(property.Value.GetString()); - continue; - } - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new EntitiesTaskParameters(loggingOptOut, modelVersion, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new EntitiesTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEntitiesTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.cs index 2a40db9313b7..bfbf737cfaf4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for an Entity Recognition task. - internal partial class EntitiesTaskParameters : PreBuiltTaskParameters + internal partial class EntitiesTaskParameters { /// Initializes a new instance of . public EntitiesTaskParameters() @@ -16,15 +16,21 @@ public EntitiesTaskParameters() } /// Initializes a new instance of . - /// - /// - /// 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. - internal EntitiesTaskParameters(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType) : base(loggingOptOut, modelVersion) + /// logging opt out. + /// model version. + /// (Optional) parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + internal EntitiesTaskParameters(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; StringIndexType = stringIndexType; } - /// 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. + /// 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.TextAnalytics/src/Generated/Models/EntitiesTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskResult.cs index 7b3990233069..f331420d8fd1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesTaskResult.cs @@ -9,11 +9,11 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntitiesTaskResult. + /// Contains the entity task. internal partial class EntitiesTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// + /// Results for entity recognition. /// is null. internal EntitiesTaskResult(EntitiesResult results) { @@ -24,15 +24,15 @@ internal EntitiesTaskResult(EntitiesResult results) } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. - /// + /// The kind of task result. + /// Results for entity recognition. internal EntitiesTaskResult(AnalyzeTextTaskResultsKind kind, EntitiesResult results) : base(kind) { Results = results; Kind = kind; } - /// Gets the results. + /// Results for entity recognition. public EntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.Serialization.cs index 54dd5f7dd658..7a48d12a66f5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.Serialization.cs @@ -6,33 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class Entity : IUtf8JsonSerializable + internal partial class Entity { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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.WriteEndObject(); - } - internal static Entity DeserializeEntity(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -94,13 +72,5 @@ internal static Entity FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeEntity(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.cs index 57b530540792..efab17afcaa4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Entity.cs @@ -9,7 +9,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The Entity. + /// Defines the detected entity object containing the entity category and entity text detected, etc. internal partial class Entity { /// Initializes a new instance of . @@ -19,7 +19,7 @@ internal partial class Entity /// 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. - public Entity(string text, string category, int offset, int length, double confidenceScore) + internal Entity(string text, string category, int offset, int length, double confidenceScore) { Argument.AssertNotNull(text, nameof(text)); Argument.AssertNotNull(category, nameof(category)); @@ -49,16 +49,16 @@ internal Entity(string text, string category, string subcategory, int offset, in } /// Entity text as appears in the request. - public string Text { get; set; } + public string Text { get; } /// Entity type. - public string Category { get; set; } + public string Category { get; } /// (Optional) Entity sub type. - public string Subcategory { get; set; } + public string Subcategory { get; } /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. - public int Offset { get; set; } + public int Offset { get; } /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. - public int Length { get; set; } + public int Length { get; } /// Confidence score between 0 and 1 of the extracted entity. - public double ConfidenceScore { get; set; } + public double ConfidenceScore { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.Serialization.cs index 61c98f1e2c11..0a2b4176b132 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics { - public partial class EntityDataSource : IUtf8JsonSerializable + public partial class EntityDataSource { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("dataSource"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(EntityId); - writer.WriteEndObject(); - } - internal static EntityDataSource DeserializeEntityDataSource(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,13 +42,5 @@ internal static EntityDataSource FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeEntityDataSource(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.cs index 01ea47935077..03fed56c0d35 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityDataSource.cs @@ -9,7 +9,7 @@ namespace Azure.AI.TextAnalytics { - /// The HealthcareEntityLink. + /// Reference to an entity in known data sources. public partial class EntityDataSource { } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.Serialization.cs index b52dbbb5059b..dbc56b69e16c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class EntityLinkingLROResult : IUtf8JsonSerializable + internal partial class EntityLinkingLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static EntityLinkingLROResult DeserializeEntityLinkingLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static EntityLinkingLROResult DeserializeEntityLinkingLROResult(JsonEle return null; } EntityLinkingResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static EntityLinkingLROResult DeserializeEntityLinkingLROResult(JsonEle results = EntityLinkingResult.DeserializeEntityLinkingResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new EntityLinkingLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new EntityLinkingLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static EntityLinkingLROResult DeserializeEntityLinkingLROResult(JsonEle using var document = JsonDocument.Parse(response.Content); return DeserializeEntityLinkingLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.cs index fe0291a36ae2..917500169bb5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntityLinkingLROResult. + /// Contains the analyze text Entity linking task LRO result. internal partial class EntityLinkingLROResult : AnalyzeTextLROResult { /// 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. - public EntityLinkingLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, EntityLinkingResult results) : base(lastUpdateDateTime, status) + internal EntityLinkingLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, EntityLinkingResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public EntityLinkingLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOp } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal EntityLinkingLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, EntityLinkingResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// Entity linking result. + internal EntityLinkingLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, EntityLinkingResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public EntityLinkingResult Results { get; set; } + /// Entity linking result. + public EntityLinkingResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.Serialization.cs index 91fbd76296fc..2ee758a4997b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static EntityLinkingLROTask DeserializeEntityLinkingLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - EntityLinkingTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = EntityLinkingTaskParameters.DeserializeEntityLinkingTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new EntityLinkingLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new EntityLinkingLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEntityLinkingLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.cs index 434d46ac8275..a9808e6b57b8 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingLROTask.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// An object representing the task definition for an Entity Linking task. + /// Contains the analyze text Entity linking LRO task. internal partial class EntityLinkingLROTask : AnalyzeTextLROTask { /// Initializes a new instance of . @@ -17,16 +17,16 @@ public EntityLinkingLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for an Entity Linking task. + /// task name. + /// The kind of task to perform. + /// Task parameters. internal EntityLinkingLROTask(string taskName, AnalyzeTextLROTaskKind kind, EntityLinkingTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for an Entity Linking task. + /// Task parameters. public EntityLinkingTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.Serialization.cs index 1f97f705ab8b..2ef5806de4d6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class EntityLinkingResult : IUtf8JsonSerializable + internal partial class EntityLinkingResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static EntityLinkingResult DeserializeEntityLinkingResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(EntityLinkingResultDocumentsItem.DeserializeEntityLinkingResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static EntityLinkingResult DeserializeEntityLinkingResult(JsonElement e modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LinkedEntitiesDocumentResult.DeserializeLinkedEntitiesDocumentResult(item)); + } + documents = array; + continue; + } } return new EntityLinkingResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new EntityLinkingResult FromResponse(Response response) + internal static EntityLinkingResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeEntityLinkingResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.cs index a48c7a1d0590..112231249fd9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntityLinkingResult. - internal partial class EntityLinkingResult : PreBuiltResult + /// Entity linking result. + internal partial class EntityLinkingResult { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. /// Response by document. /// , or is null. - public EntityLinkingResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + 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(); } @@ -33,12 +35,21 @@ public EntityLinkingResult(IEnumerable errors, string modelVersio /// 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. - internal EntityLinkingResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + internal EntityLinkingResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } + /// 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 TextDocumentBatchStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } /// Response by document. - public IList Documents { get; } + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.Serialization.cs deleted file mode 100644 index 5552a3afd3e8..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class EntityLinkingResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static EntityLinkingResultDocumentsItem DeserializeEntityLinkingResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList entities = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(LinkedEntity.DeserializeLinkedEntity(item)); - } - entities = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new EntityLinkingResultDocumentsItem(id, warnings, statistics, entities); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new EntityLinkingResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEntityLinkingResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.cs deleted file mode 100644 index f3967c70e2b9..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The EntityLinkingResultDocumentsItem. - internal partial class EntityLinkingResultDocumentsItem : LinkedEntitiesDocumentResult - { - /// 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. - public EntityLinkingResultDocumentsItem(string id, IEnumerable warnings, IEnumerable entities) : base(id, warnings, entities) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(entities, nameof(entities)); - } - - /// 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. - internal EntityLinkingResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, IList entities) : base(id, warnings, statistics, entities) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.Serialization.cs index 8f75a6727544..815aa508b5d1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.Serialization.cs @@ -15,72 +15,26 @@ internal partial class EntityLinkingTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(StringIndexType)) + if (Optional.IsDefined(LoggingOptOut)) { - writer.WritePropertyName("stringIndexType"u8); - writer.WriteStringValue(StringIndexType.Value.ToString()); + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); } if (Optional.IsDefined(ModelVersion)) { writer.WritePropertyName("modelVersion"u8); writer.WriteStringValue(ModelVersion); } - if (Optional.IsDefined(LoggingOptOut)) + if (Optional.IsDefined(StringIndexType)) { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); } writer.WriteEndObject(); } - internal static EntityLinkingTaskParameters DeserializeEntityLinkingTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StringIndexType? stringIndexType = default; - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("stringIndexType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stringIndexType = new StringIndexType(property.Value.GetString()); - continue; - } - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new EntityLinkingTaskParameters(loggingOptOut, modelVersion, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new EntityLinkingTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeEntityLinkingTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.cs index 630a89b0245a..f2ace0f3f80c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for an Entity Linking task. - internal partial class EntityLinkingTaskParameters : PreBuiltTaskParameters + internal partial class EntityLinkingTaskParameters { /// Initializes a new instance of . public EntityLinkingTaskParameters() @@ -16,15 +16,21 @@ public EntityLinkingTaskParameters() } /// Initializes a new instance of . - /// - /// - /// 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. - internal EntityLinkingTaskParameters(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType) : base(loggingOptOut, modelVersion) + /// logging opt out. + /// model version. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + internal EntityLinkingTaskParameters(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; StringIndexType = stringIndexType; } - /// 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. + /// 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.TextAnalytics/src/Generated/Models/EntityLinkingTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskResult.cs index 7989552ea9f5..d3fb8f6a7659 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingTaskResult.cs @@ -9,11 +9,11 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntityLinkingTaskResult. + /// Contains the analyze text Entity linking task result. internal partial class EntityLinkingTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// + /// Entity linking result. /// is null. internal EntityLinkingTaskResult(EntityLinkingResult results) { @@ -24,15 +24,15 @@ internal EntityLinkingTaskResult(EntityLinkingResult results) } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. - /// + /// The kind of task result. + /// Entity linking result. internal EntityLinkingTaskResult(AnalyzeTextTaskResultsKind kind, EntityLinkingResult results) : base(kind) { Results = results; Kind = kind; } - /// Gets the results. + /// Entity linking result. public EntityLinkingResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.Serialization.cs index 420973855c6e..85c67ac8ee83 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class EntityRecognitionLROResult : IUtf8JsonSerializable + internal partial class EntityRecognitionLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static EntityRecognitionLROResult DeserializeEntityRecognitionLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static EntityRecognitionLROResult DeserializeEntityRecognitionLROResult return null; } EntitiesResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static EntityRecognitionLROResult DeserializeEntityRecognitionLROResult results = EntitiesResult.DeserializeEntitiesResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new EntityRecognitionLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new EntityRecognitionLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static EntityRecognitionLROResult DeserializeEntityRecognitionLROResult using var document = JsonDocument.Parse(response.Content); return DeserializeEntityRecognitionLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.cs index 7e58f252e4e9..458888844a25 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityRecognitionLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The EntityRecognitionLROResult. + /// Contains the entity recognition job task result. internal partial class EntityRecognitionLROResult : AnalyzeTextLROResult { /// 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. - public EntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, EntitiesResult results) : base(lastUpdateDateTime, status) + internal EntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, EntitiesResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public EntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyti } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal EntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, EntitiesResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// Results for the task. + internal EntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, EntitiesResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public EntitiesResult Results { get; set; } + /// Results for the task. + public EntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.Serialization.cs index 2752ae9a1863..9718e03c6677 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.Serialization.cs @@ -7,47 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class Error : IUtf8JsonSerializable + internal partial class Error { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(Innererror)) - { - writer.WritePropertyName("innererror"u8); - writer.WriteObjectValue(Innererror); - } - foreach (var item in AdditionalProperties) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - internal static Error DeserializeError(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -57,10 +21,8 @@ internal static Error DeserializeError(JsonElement element) ErrorCode code = default; string message = default; string target = default; - IList details = default; + IReadOnlyList details = default; InnerErrorModel innererror = default; - IDictionary additionalProperties = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("code"u8)) @@ -101,16 +63,8 @@ internal static Error DeserializeError(JsonElement element) innererror = InnerErrorModel.DeserializeInnerErrorModel(property.Value); continue; } - additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject()); } - additionalProperties = additionalPropertiesDictionary; - return new Error( - code, - message, - target, - details ?? new ChangeTrackingList(), - innererror, - additionalProperties); + return new Error(code, message, target, details ?? new ChangeTrackingList(), innererror); } /// Deserializes the model from a raw response. @@ -120,13 +74,5 @@ internal static Error FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeError(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.cs index 8171965e6d24..5c7e29245e14 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Error.cs @@ -10,21 +10,20 @@ namespace Azure.AI.TextAnalytics.Models { - /// The error object. + /// The error response object returned when the service encounters some errors during processing the request. internal partial class Error { /// Initializes a new instance of . /// One of a server-defined set of error codes. /// A human-readable representation of the error. /// is null. - public Error(ErrorCode code, string message) + internal Error(ErrorCode code, string message) { Argument.AssertNotNull(message, nameof(message)); Code = code; Message = message; Details = new ChangeTrackingList(); - AdditionalProperties = new ChangeTrackingDictionary(); } /// Initializes a new instance of . @@ -33,28 +32,24 @@ public Error(ErrorCode code, string message) /// 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. - /// Additional Properties. - internal Error(ErrorCode code, string message, string target, IList details, InnerErrorModel innererror, IDictionary additionalProperties) + internal Error(ErrorCode code, string message, string target, IReadOnlyList details, InnerErrorModel innererror) { Code = code; Message = message; Target = target; Details = details; Innererror = innererror; - AdditionalProperties = additionalProperties; } /// One of a server-defined set of error codes. - public ErrorCode Code { get; set; } + public ErrorCode Code { get; } /// A human-readable representation of the error. - public string Message { get; set; } + public string Message { get; } /// The target of the error. - public string Target { get; set; } + public string Target { get; } /// An array of details about specific errors that led to this reported error. - public IList Details { get; } + public IReadOnlyList Details { get; } /// An object containing more specific information than the current object about the error. - public InnerErrorModel Innererror { get; set; } - /// Additional Properties. - public IDictionary AdditionalProperties { get; } + public InnerErrorModel Innererror { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ErrorCode.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ErrorCode.cs index 8f638583f5d1..e827ada6884e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ErrorCode.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ErrorCode.cs @@ -41,41 +41,41 @@ public ErrorCode(string value) private const string ConflictValue = "Conflict"; private const string WarningValue = "Warning"; - /// InvalidRequest. + /// Invalid request error. public static ErrorCode InvalidRequest { get; } = new ErrorCode(InvalidRequestValue); - /// InvalidArgument. + /// Invalid argument error. public static ErrorCode InvalidArgument { get; } = new ErrorCode(InvalidArgumentValue); - /// Unauthorized. + /// Unauthorized access error. public static ErrorCode Unauthorized { get; } = new ErrorCode(UnauthorizedValue); - /// Forbidden. + /// Forbidden access error. public static ErrorCode Forbidden { get; } = new ErrorCode(ForbiddenValue); - /// NotFound. + /// Not found error. public static ErrorCode NotFound { get; } = new ErrorCode(NotFoundValue); - /// ProjectNotFound. + /// Project not found error. public static ErrorCode ProjectNotFound { get; } = new ErrorCode(ProjectNotFoundValue); - /// OperationNotFound. + /// Operation not found error. public static ErrorCode OperationNotFound { get; } = new ErrorCode(OperationNotFoundValue); - /// AzureCognitiveSearchNotFound. + /// Azure Cognitive Search not found error. public static ErrorCode AzureCognitiveSearchNotFound { get; } = new ErrorCode(AzureCognitiveSearchNotFoundValue); - /// AzureCognitiveSearchIndexNotFound. + /// Azure Cognitive Search index not found error. public static ErrorCode AzureCognitiveSearchIndexNotFound { get; } = new ErrorCode(AzureCognitiveSearchIndexNotFoundValue); - /// TooManyRequests. + /// Too many requests error. public static ErrorCode TooManyRequests { get; } = new ErrorCode(TooManyRequestsValue); - /// AzureCognitiveSearchThrottling. + /// Azure Cognitive Search throttling error. public static ErrorCode AzureCognitiveSearchThrottling { get; } = new ErrorCode(AzureCognitiveSearchThrottlingValue); - /// AzureCognitiveSearchIndexLimitReached. + /// Azure Cognitive Search index limit reached error. public static ErrorCode AzureCognitiveSearchIndexLimitReached { get; } = new ErrorCode(AzureCognitiveSearchIndexLimitReachedValue); - /// InternalServerError. + /// Internal server error. public static ErrorCode InternalServerError { get; } = new ErrorCode(InternalServerErrorValue); - /// ServiceUnavailable. + /// Service unavailable error. public static ErrorCode ServiceUnavailable { get; } = new ErrorCode(ServiceUnavailableValue); - /// Timeout. + /// Timeout error. public static ErrorCode Timeout { get; } = new ErrorCode(TimeoutValue); - /// QuotaExceeded. + /// Quota exceeded error. public static ErrorCode QuotaExceeded { get; } = new ErrorCode(QuotaExceededValue); - /// Conflict. + /// Conflict error. public static ErrorCode Conflict { get; } = new ErrorCode(ConflictValue); - /// Warning. + /// Warning error. public static ErrorCode Warning { get; } = new ErrorCode(WarningValue); /// Determines if two values are the same. public static bool operator ==(ErrorCode left, ErrorCode right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.Serialization.cs index 38b07181c0e4..e01f5d79dcd7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class ExtractedSummaryDocumentResult : IUtf8JsonSerializable + internal partial class ExtractedSummaryDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("sentences"u8); - writer.WriteStartArray(); - foreach (var item in Sentences) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static ExtractedSummaryDocumentResult DeserializeExtractedSummaryDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList sentences = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList sentences = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sentences"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ExtractedSummarySentence.DeserializeExtractedSummarySentence(item)); - } - sentences = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -86,24 +48,26 @@ internal static ExtractedSummaryDocumentResult DeserializeExtractedSummaryDocume statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExtractedSummarySentence.DeserializeExtractedSummarySentence(item)); + } + sentences = array; + continue; + } } return new ExtractedSummaryDocumentResult(id, warnings, statistics, sentences); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new ExtractedSummaryDocumentResult FromResponse(Response response) + internal static ExtractedSummaryDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeExtractedSummaryDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.cs index 462066aa88ba..a7355df0ce3d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummaryDocumentResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The ExtractedSummaryDocumentResult. - internal partial class ExtractedSummaryDocumentResult : DocumentResult + /// A ranked list of sentences representing the extracted summary. + internal partial class ExtractedSummaryDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. /// Warnings encountered while processing document. - /// A ranked list of sentences representing the extracted summary. + /// Specifies the the extracted sentences from the input document. /// , or is null. - public ExtractedSummaryDocumentResult(string id, IEnumerable warnings, IEnumerable sentences) : base(id, warnings) + internal ExtractedSummaryDocumentResult(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(); } @@ -32,13 +34,22 @@ public ExtractedSummaryDocumentResult(string id, IEnumerable wa /// 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 ranked list of sentences representing the extracted summary. - internal ExtractedSummaryDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList sentences) : base(id, warnings, statistics) + /// Specifies the the extracted sentences from the input document. + internal ExtractedSummaryDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList sentences) { + Id = id; + Warnings = warnings; + Statistics = statistics; Sentences = sentences; } - /// A ranked list of sentences representing the extracted summary. - public IList Sentences { get; } + /// 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 TextDocumentStatistics? Statistics { get; } + /// Specifies the the extracted sentences from the input document. + public IReadOnlyList Sentences { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.Serialization.cs index 31f2d0b0e8da..e2a0d9f7d163 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.Serialization.cs @@ -6,26 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class ExtractedSummarySentence : IUtf8JsonSerializable + internal partial class ExtractedSummarySentence { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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); - writer.WriteEndObject(); - } - internal static ExtractedSummarySentence DeserializeExtractedSummarySentence(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -69,13 +54,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.cs index c1fab1c9ee90..03b41e5deb09 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractedSummarySentence.cs @@ -9,7 +9,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The ExtractedSummarySentence. + /// Represents an extracted sentences from the input document. internal partial class ExtractedSummarySentence { /// Initializes a new instance of . @@ -18,7 +18,7 @@ internal partial class ExtractedSummarySentence /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. /// The length of the sentence. /// is null. - public ExtractedSummarySentence(string text, double rankScore, int offset, int length) + internal ExtractedSummarySentence(string text, double rankScore, int offset, int length) { Argument.AssertNotNull(text, nameof(text)); @@ -29,12 +29,12 @@ public ExtractedSummarySentence(string text, double rankScore, int offset, int l } /// The extracted sentence text. - public string Text { get; set; } + 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; set; } + 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; set; } + public int Offset { get; } /// The length of the sentence. - public int Length { get; set; } + public int Length { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.Serialization.cs index 86f6eb507ddc..bf5dd41ed2d5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class ExtractiveSummarizationLROResult : IUtf8JsonSerializable + internal partial class ExtractiveSummarizationLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static ExtractiveSummarizationLROResult DeserializeExtractiveSummarizationLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static ExtractiveSummarizationLROResult DeserializeExtractiveSummarizat return null; } ExtractiveSummarizationResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static ExtractiveSummarizationLROResult DeserializeExtractiveSummarizat results = ExtractiveSummarizationResult.DeserializeExtractiveSummarizationResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new ExtractiveSummarizationLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new ExtractiveSummarizationLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static ExtractiveSummarizationLROResult DeserializeExtractiveSummarizat using var document = JsonDocument.Parse(response.Content); return DeserializeExtractiveSummarizationLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.cs index b590b1022d19..a9bfccdc2f50 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The ExtractiveSummarizationLROResult. + /// An object representing the results for an Extractive Summarization task. internal partial class ExtractiveSummarizationLROResult : AnalyzeTextLROResult { /// 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. - public ExtractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status) + internal ExtractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public ExtractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextA } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal ExtractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// Results of the task. + internal ExtractiveSummarizationLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public ExtractiveSummarizationResult Results { get; set; } + /// Results of the task. + public ExtractiveSummarizationResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.Serialization.cs index b3c77501d003..ecb29aa756c9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static ExtractiveSummarizationLROTask DeserializeExtractiveSummarizationLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ExtractiveSummarizationTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = ExtractiveSummarizationTaskParameters.DeserializeExtractiveSummarizationTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new ExtractiveSummarizationLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new ExtractiveSummarizationLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeExtractiveSummarizationLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.cs index fd4d7569d227..b9f9323a902d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationLROTask.cs @@ -17,16 +17,16 @@ public ExtractiveSummarizationLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for an Extractive Summarization task. + /// task name. + /// The kind of task to perform. + /// Parameters for the Extractive Summarization task. internal ExtractiveSummarizationLROTask(string taskName, AnalyzeTextLROTaskKind kind, ExtractiveSummarizationTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for an Extractive Summarization task. + /// Parameters for the Extractive Summarization task. public ExtractiveSummarizationTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs index 418d949fdcc2..fd6f839d54bf 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class ExtractiveSummarizationResult : IUtf8JsonSerializable + internal partial class ExtractiveSummarizationResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static ExtractiveSummarizationResult DeserializeExtractiveSummarizationResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ExtractedSummaryDocumentResult.DeserializeExtractedSummaryDocumentResult(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static ExtractiveSummarizationResult DeserializeExtractiveSummarization modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExtractedSummaryDocumentResult.DeserializeExtractedSummaryDocumentResult(item)); + } + documents = array; + continue; + } } return new ExtractiveSummarizationResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new ExtractiveSummarizationResult FromResponse(Response response) + internal static ExtractiveSummarizationResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeExtractiveSummarizationResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.cs index 41f1f77561e1..3d69cce9e3c9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The ExtractiveSummarizationResult. - internal partial class ExtractiveSummarizationResult : PreBuiltResult + /// An object representing the pre-built Extractive Summarization results of each document. + internal partial class ExtractiveSummarizationResult { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. /// Response by document. /// , or is null. - public ExtractiveSummarizationResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + 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(); } @@ -33,12 +35,21 @@ public ExtractiveSummarizationResult(IEnumerable errors, string m /// 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. - internal ExtractiveSummarizationResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + internal ExtractiveSummarizationResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } + /// 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 TextDocumentBatchStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } /// Response by document. - public IList Documents { get; } + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.Serialization.cs index cb72bb8ddc49..bcffeaa1f59e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.Serialization.cs @@ -15,6 +15,16 @@ internal partial class ExtractiveSummarizationTaskParameters : IUtf8JsonSerializ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + 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); @@ -30,87 +40,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("stringIndexType"u8); writer.WriteStringValue(StringIndexType.Value.ToString()); } - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } - if (Optional.IsDefined(LoggingOptOut)) - { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); - } writer.WriteEndObject(); } - internal static ExtractiveSummarizationTaskParameters DeserializeExtractiveSummarizationTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? sentenceCount = default; - ExtractiveSummarySentencesOrder? sortBy = default; - StringIndexType? stringIndexType = default; - string modelVersion = default; - bool? loggingOptOut = default; - 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("sortBy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sortBy = new ExtractiveSummarySentencesOrder(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("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new ExtractiveSummarizationTaskParameters(loggingOptOut, modelVersion, sentenceCount, sortBy, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new ExtractiveSummarizationTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeExtractiveSummarizationTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.cs index b1ab48b6d40c..19aa5e3bc317 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarizationTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for an Extractive Summarization task. - internal partial class ExtractiveSummarizationTaskParameters : PreBuiltTaskParameters + internal partial class ExtractiveSummarizationTaskParameters { /// Initializes a new instance of . public ExtractiveSummarizationTaskParameters() @@ -16,23 +16,29 @@ public ExtractiveSummarizationTaskParameters() } /// Initializes a new instance of . - /// - /// - /// - /// The sorting criteria to use for the results of Extractive Summarization. - /// 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. - internal ExtractiveSummarizationTaskParameters(bool? loggingOptOut, string modelVersion, int? sentenceCount, ExtractiveSummarySentencesOrder? sortBy, StringIndexType? stringIndexType) : base(loggingOptOut, modelVersion) + /// 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. + internal ExtractiveSummarizationTaskParameters(bool? loggingOptOut, string modelVersion, long? sentenceCount, ExtractiveSummarySentencesOrder? sortBy, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; SentenceCount = sentenceCount; SortBy = sortBy; StringIndexType = stringIndexType; } - /// Gets or sets the sentence count. - public int? SentenceCount { get; set; } - /// The sorting criteria to use for the results of Extractive Summarization. + /// 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 ExtractiveSummarySentencesOrder? SortBy { get; set; } - /// 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. + /// Specifies the method used to interpret string offsets. public StringIndexType? StringIndexType { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarySentencesOrder.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarySentencesOrder.cs index bb5c43b66ef8..b9d3903ea916 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarySentencesOrder.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/ExtractiveSummarySentencesOrder.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics { - /// The sorting criteria to use for the results of Extractive Summarization. + /// Specifies how to sort the extracted summaries. public readonly partial struct ExtractiveSummarySentencesOrder : IEquatable { private readonly string _value; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.Serialization.cs index d5d33a1314bf..c8fe8dc9c26d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.Serialization.cs @@ -7,79 +7,24 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class HealthcareEntitiesDocumentResult : IUtf8JsonSerializable + internal partial class HealthcareEntitiesDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("relations"u8); - writer.WriteStartArray(); - foreach (var item in Relations) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static HealthcareEntitiesDocumentResult DeserializeHealthcareEntitiesDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList entities = default; - IList relations = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList entities = default; + IReadOnlyList relations = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(HealthcareEntityInternal.DeserializeHealthcareEntityInternal(item)); - } - entities = array; - continue; - } - if (property.NameEquals("relations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(HealthcareRelationInternal.DeserializeHealthcareRelationInternal(item)); - } - relations = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -104,24 +49,36 @@ internal static HealthcareEntitiesDocumentResult DeserializeHealthcareEntitiesDo statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntityInternal.DeserializeHealthcareEntityInternal(item)); + } + entities = array; + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelationInternal.DeserializeHealthcareRelationInternal(item)); + } + relations = array; + continue; + } } return new HealthcareEntitiesDocumentResult(id, warnings, statistics, entities, relations); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new HealthcareEntitiesDocumentResult FromResponse(Response response) + internal static HealthcareEntitiesDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeHealthcareEntitiesDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.cs index 67a7876d127b..4f0945e0d0ab 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntitiesDocumentResult.cs @@ -11,8 +11,8 @@ namespace Azure.AI.TextAnalytics.Models { - /// The HealthcareEntitiesDocumentResult. - internal partial class HealthcareEntitiesDocumentResult : DocumentResult + /// Result object for the processed Healthcare document. + internal partial class HealthcareEntitiesDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. @@ -20,13 +20,15 @@ internal partial class HealthcareEntitiesDocumentResult : DocumentResult /// Healthcare entities. /// Healthcare entity relations. /// , , or is null. - public HealthcareEntitiesDocumentResult(string id, IEnumerable warnings, IEnumerable entities, IEnumerable relations) : base(id, warnings) + internal HealthcareEntitiesDocumentResult(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(); } @@ -37,15 +39,24 @@ public HealthcareEntitiesDocumentResult(string id, IEnumerable /// if showStats=true was specified in the request this field will contain information about the document payload. /// Healthcare entities. /// Healthcare entity relations. - internal HealthcareEntitiesDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList entities, IList relations) : base(id, warnings, statistics) + internal HealthcareEntitiesDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList entities, IReadOnlyList relations) { + Id = id; + Warnings = warnings; + Statistics = statistics; Entities = entities; Relations = relations; } + /// 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 TextDocumentStatistics? Statistics { get; } /// Healthcare entities. - public IList Entities { get; } + public IReadOnlyList Entities { get; } /// Healthcare entity relations. - public IList Relations { get; } + public IReadOnlyList Relations { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.Serialization.cs index cb037b910fdc..1ccd7cc31b4b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.Serialization.cs @@ -6,33 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics { - public partial class HealthcareEntityAssertion : IUtf8JsonSerializable + public partial class HealthcareEntityAssertion { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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()); - } - writer.WriteEndObject(); - } - internal static HealthcareEntityAssertion DeserializeHealthcareEntityAssertion(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,13 +60,5 @@ internal static HealthcareEntityAssertion FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeHealthcareEntityAssertion(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.cs index 2c618651c931..91993a8c487c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityAssertion.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics { - /// The HealthcareAssertion. + /// Assertion of the entity. public partial class HealthcareEntityAssertion { /// Initializes a new instance of . diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityCategory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityCategory.cs index 8347c35c3481..45888d99f373 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityCategory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityCategory.cs @@ -25,7 +25,6 @@ public HealthcareEntityCategory(string value) private const string BodyStructureValue = "BodyStructure"; private const string AgeValue = "Age"; private const string GenderValue = "Gender"; - private const string EthnicityValue = "Ethnicity"; private const string ExaminationNameValue = "ExaminationName"; private const string DateValue = "Date"; private const string DirectionValue = "Direction"; @@ -34,18 +33,14 @@ public HealthcareEntityCategory(string value) private const string MeasurementUnitValue = "MeasurementUnit"; private const string RelationalOperatorValue = "RelationalOperator"; private const string TimeValue = "Time"; - private const string CourseValue = "Course"; private const string GeneOrProteinValue = "GeneOrProtein"; private const string VariantValue = "Variant"; - private const string ExpressionValue = "Expression"; - private const string MutationTypeValue = "MutationType"; 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 ConditionScaleValue = "ConditionScale"; private const string MedicationClassValue = "MedicationClass"; private const string MedicationNameValue = "MedicationName"; private const string DosageValue = "Dosage"; @@ -53,21 +48,24 @@ public HealthcareEntityCategory(string value) 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"; - /// BodyStructure. + /// 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); - /// Ethnicity. - public static HealthcareEntityCategory Ethnicity { get; } = new HealthcareEntityCategory(EthnicityValue); - /// ExaminationName. + /// Examination name. public static HealthcareEntityCategory ExaminationName { get; } = new HealthcareEntityCategory(ExaminationNameValue); /// Date. public static HealthcareEntityCategory Date { get; } = new HealthcareEntityCategory(DateValue); @@ -75,61 +73,63 @@ public HealthcareEntityCategory(string value) public static HealthcareEntityCategory Direction { get; } = new HealthcareEntityCategory(DirectionValue); /// Frequency. public static HealthcareEntityCategory Frequency { get; } = new HealthcareEntityCategory(FrequencyValue); - /// MeasurementValue. + /// Measurement value. public static HealthcareEntityCategory MeasurementValue { get; } = new HealthcareEntityCategory(MeasurementValueValue); - /// MeasurementUnit. + /// Measurement unit. public static HealthcareEntityCategory MeasurementUnit { get; } = new HealthcareEntityCategory(MeasurementUnitValue); - /// RelationalOperator. + /// Relational operator. public static HealthcareEntityCategory RelationalOperator { get; } = new HealthcareEntityCategory(RelationalOperatorValue); /// Time. public static HealthcareEntityCategory Time { get; } = new HealthcareEntityCategory(TimeValue); - /// Course. - public static HealthcareEntityCategory Course { get; } = new HealthcareEntityCategory(CourseValue); - /// GeneOrProtein. + /// Gene or protein. public static HealthcareEntityCategory GeneOrProtein { get; } = new HealthcareEntityCategory(GeneOrProteinValue); /// Variant. public static HealthcareEntityCategory Variant { get; } = new HealthcareEntityCategory(VariantValue); - /// Expression. - public static HealthcareEntityCategory Expression { get; } = new HealthcareEntityCategory(ExpressionValue); - /// MutationType. - public static HealthcareEntityCategory MutationType { get; } = new HealthcareEntityCategory(MutationTypeValue); - /// AdministrativeEvent. + /// Administrative event. public static HealthcareEntityCategory AdministrativeEvent { get; } = new HealthcareEntityCategory(AdministrativeEventValue); - /// CareEnvironment. + /// Care environment. public static HealthcareEntityCategory CareEnvironment { get; } = new HealthcareEntityCategory(CareEnvironmentValue); - /// HealthcareProfession. + /// Healthcare profession. public static HealthcareEntityCategory HealthcareProfession { get; } = new HealthcareEntityCategory(HealthcareProfessionValue); /// Diagnosis. public static HealthcareEntityCategory Diagnosis { get; } = new HealthcareEntityCategory(DiagnosisValue); - /// SymptomOrSign. + /// Symptom or sign. public static HealthcareEntityCategory SymptomOrSign { get; } = new HealthcareEntityCategory(SymptomOrSignValue); - /// ConditionQualifier. + /// Condition qualifier. public static HealthcareEntityCategory ConditionQualifier { get; } = new HealthcareEntityCategory(ConditionQualifierValue); - /// ConditionScale. - public static HealthcareEntityCategory ConditionScale { get; } = new HealthcareEntityCategory(ConditionScaleValue); - /// MedicationClass. + /// Medication class. public static HealthcareEntityCategory MedicationClass { get; } = new HealthcareEntityCategory(MedicationClassValue); - /// MedicationName. + /// Medication name. public static HealthcareEntityCategory MedicationName { get; } = new HealthcareEntityCategory(MedicationNameValue); /// Dosage. public static HealthcareEntityCategory Dosage { get; } = new HealthcareEntityCategory(DosageValue); - /// MedicationForm. + /// Medication form. public static HealthcareEntityCategory MedicationForm { get; } = new HealthcareEntityCategory(MedicationFormValue); - /// MedicationRoute. + /// Medication route. public static HealthcareEntityCategory MedicationRoute { get; } = new HealthcareEntityCategory(MedicationRouteValue); - /// FamilyRelation. + /// Family relation. public static HealthcareEntityCategory FamilyRelation { get; } = new HealthcareEntityCategory(FamilyRelationValue); - /// TreatmentName. + /// 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); - /// LivingStatus. + /// Living status. public static HealthcareEntityCategory LivingStatus { get; } = new HealthcareEntityCategory(LivingStatusValue); - /// SubstanceUse. + /// Substance use. public static HealthcareEntityCategory SubstanceUse { get; } = new HealthcareEntityCategory(SubstanceUseValue); - /// SubstanceUseAmount. + /// 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); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.Serialization.cs index 9f3e1f6abbd9..87aec2799cdd 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.Serialization.cs @@ -7,53 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class HealthcareEntityInternal : IUtf8JsonSerializable + internal partial class HealthcareEntityInternal { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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); - } - 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); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - internal static HealthcareEntityInternal DeserializeHealthcareEntityInternal(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -68,7 +26,7 @@ internal static HealthcareEntityInternal DeserializeHealthcareEntityInternal(Jso double confidenceScore = default; HealthcareEntityAssertion assertion = default; string name = default; - IList links = default; + IReadOnlyList links = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("text"u8)) @@ -149,13 +107,5 @@ internal static HealthcareEntityInternal FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeHealthcareEntityInternal(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.cs index b06f3bcada85..d384a4bd2ce5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityInternal.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The HealthcareEntity. + /// Healthcare entity extracted from the document. internal partial class HealthcareEntityInternal { /// Initializes a new instance of . @@ -20,7 +20,7 @@ internal partial class HealthcareEntityInternal /// 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. - public HealthcareEntityInternal(string text, HealthcareEntityCategory category, int offset, int length, double confidenceScore) + internal HealthcareEntityInternal(string text, HealthcareEntityCategory category, int offset, int length, double confidenceScore) { Argument.AssertNotNull(text, nameof(text)); @@ -39,10 +39,10 @@ public HealthcareEntityInternal(string text, HealthcareEntityCategory 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. - /// + /// Assertion of the entity. /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. /// Entity references in known data sources. - internal HealthcareEntityInternal(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareEntityAssertion assertion, string name, IList links) + internal HealthcareEntityInternal(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareEntityAssertion assertion, string name, IReadOnlyList links) { Text = text; Category = category; @@ -56,22 +56,22 @@ internal HealthcareEntityInternal(string text, HealthcareEntityCategory category } /// Entity text as appears in the request. - public string Text { get; set; } + public string Text { get; } /// Healthcare Entity Category. - public HealthcareEntityCategory Category { get; set; } + public HealthcareEntityCategory Category { get; } /// (Optional) Entity sub type. - public string Subcategory { get; set; } + public string Subcategory { get; } /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. - public int Offset { get; set; } + public int Offset { get; } /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. - public int Length { get; set; } + public int Length { get; } /// Confidence score between 0 and 1 of the extracted entity. - public double ConfidenceScore { get; set; } - /// Gets or sets the assertion. - public HealthcareEntityAssertion Assertion { get; set; } + public double ConfidenceScore { get; } + /// Assertion of the entity. + public HealthcareEntityAssertion Assertion { get; } /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. - public string Name { get; set; } + public string Name { get; } /// Entity references in known data sources. - public IList Links { get; } + public IReadOnlyList Links { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityRelationType.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityRelationType.cs index ac290ff6ed35..ca76f9b385b5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityRelationType.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareEntityRelationType.cs @@ -23,30 +23,17 @@ public HealthcareEntityRelationType(string value) } private const string AbbreviationValue = "Abbreviation"; - 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 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 ExaminationFindsConditionValue = "ExaminationFindsCondition"; - private const string ExpressionOfGeneValue = "ExpressionOfGene"; - private const string ExpressionOfVariantValue = "ExpressionOfVariant"; private const string FormOfMedicationValue = "FormOfMedication"; - private const string FrequencyOfConditionValue = "FrequencyOfCondition"; private const string FrequencyOfMedicationValue = "FrequencyOfMedication"; private const string FrequencyOfTreatmentValue = "FrequencyOfTreatment"; - private const string MutationTypeOfGeneValue = "MutationTypeOfGene"; - private const string MutationTypeOfVariantValue = "MutationTypeOfVariant"; private const string QualifierOfConditionValue = "QualifierOfCondition"; private const string RelationOfExaminationValue = "RelationOfExamination"; private const string RouteOfMedicationValue = "RouteOfMedication"; - private const string ScaleOfConditionValue = "ScaleOfCondition"; private const string TimeOfConditionValue = "TimeOfCondition"; private const string TimeOfEventValue = "TimeOfEvent"; private const string TimeOfExaminationValue = "TimeOfExamination"; @@ -56,77 +43,90 @@ public HealthcareEntityRelationType(string value) 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 HealthcareEntityRelationType Abbreviation { get; } = new HealthcareEntityRelationType(AbbreviationValue); - /// BodySiteOfCondition. - public static HealthcareEntityRelationType BodySiteOfCondition { get; } = new HealthcareEntityRelationType(BodySiteOfConditionValue); - /// BodySiteOfTreatment. - public static HealthcareEntityRelationType BodySiteOfTreatment { get; } = new HealthcareEntityRelationType(BodySiteOfTreatmentValue); - /// CourseOfCondition. - public static HealthcareEntityRelationType CourseOfCondition { get; } = new HealthcareEntityRelationType(CourseOfConditionValue); - /// CourseOfExamination. - public static HealthcareEntityRelationType CourseOfExamination { get; } = new HealthcareEntityRelationType(CourseOfExaminationValue); - /// CourseOfMedication. - public static HealthcareEntityRelationType CourseOfMedication { get; } = new HealthcareEntityRelationType(CourseOfMedicationValue); - /// CourseOfTreatment. - public static HealthcareEntityRelationType CourseOfTreatment { get; } = new HealthcareEntityRelationType(CourseOfTreatmentValue); - /// DirectionOfBodyStructure. + /// Direction of body structure. public static HealthcareEntityRelationType DirectionOfBodyStructure { get; } = new HealthcareEntityRelationType(DirectionOfBodyStructureValue); - /// DirectionOfCondition. + /// Direction of condition. public static HealthcareEntityRelationType DirectionOfCondition { get; } = new HealthcareEntityRelationType(DirectionOfConditionValue); - /// DirectionOfExamination. + /// Direction of examination. public static HealthcareEntityRelationType DirectionOfExamination { get; } = new HealthcareEntityRelationType(DirectionOfExaminationValue); - /// DirectionOfTreatment. + /// Direction of treatment. public static HealthcareEntityRelationType DirectionOfTreatment { get; } = new HealthcareEntityRelationType(DirectionOfTreatmentValue); - /// DosageOfMedication. + /// Dosage of medication. public static HealthcareEntityRelationType DosageOfMedication { get; } = new HealthcareEntityRelationType(DosageOfMedicationValue); - /// ExaminationFindsCondition. - public static HealthcareEntityRelationType ExaminationFindsCondition { get; } = new HealthcareEntityRelationType(ExaminationFindsConditionValue); - /// ExpressionOfGene. - public static HealthcareEntityRelationType ExpressionOfGene { get; } = new HealthcareEntityRelationType(ExpressionOfGeneValue); - /// ExpressionOfVariant. - public static HealthcareEntityRelationType ExpressionOfVariant { get; } = new HealthcareEntityRelationType(ExpressionOfVariantValue); - /// FormOfMedication. + /// Form of medication. public static HealthcareEntityRelationType FormOfMedication { get; } = new HealthcareEntityRelationType(FormOfMedicationValue); - /// FrequencyOfCondition. - public static HealthcareEntityRelationType FrequencyOfCondition { get; } = new HealthcareEntityRelationType(FrequencyOfConditionValue); - /// FrequencyOfMedication. + /// Frequency of medication. public static HealthcareEntityRelationType FrequencyOfMedication { get; } = new HealthcareEntityRelationType(FrequencyOfMedicationValue); - /// FrequencyOfTreatment. + /// Frequency of treatment. public static HealthcareEntityRelationType FrequencyOfTreatment { get; } = new HealthcareEntityRelationType(FrequencyOfTreatmentValue); - /// MutationTypeOfGene. - public static HealthcareEntityRelationType MutationTypeOfGene { get; } = new HealthcareEntityRelationType(MutationTypeOfGeneValue); - /// MutationTypeOfVariant. - public static HealthcareEntityRelationType MutationTypeOfVariant { get; } = new HealthcareEntityRelationType(MutationTypeOfVariantValue); - /// QualifierOfCondition. + /// Qualifier of condition. public static HealthcareEntityRelationType QualifierOfCondition { get; } = new HealthcareEntityRelationType(QualifierOfConditionValue); - /// RelationOfExamination. + /// Relation of examination. public static HealthcareEntityRelationType RelationOfExamination { get; } = new HealthcareEntityRelationType(RelationOfExaminationValue); - /// RouteOfMedication. + /// Route of medication. public static HealthcareEntityRelationType RouteOfMedication { get; } = new HealthcareEntityRelationType(RouteOfMedicationValue); - /// ScaleOfCondition. - public static HealthcareEntityRelationType ScaleOfCondition { get; } = new HealthcareEntityRelationType(ScaleOfConditionValue); - /// TimeOfCondition. + /// Time of condition. public static HealthcareEntityRelationType TimeOfCondition { get; } = new HealthcareEntityRelationType(TimeOfConditionValue); - /// TimeOfEvent. + /// Time of event. public static HealthcareEntityRelationType TimeOfEvent { get; } = new HealthcareEntityRelationType(TimeOfEventValue); - /// TimeOfExamination. + /// Time of examination. public static HealthcareEntityRelationType TimeOfExamination { get; } = new HealthcareEntityRelationType(TimeOfExaminationValue); - /// TimeOfMedication. + /// Time of medication. public static HealthcareEntityRelationType TimeOfMedication { get; } = new HealthcareEntityRelationType(TimeOfMedicationValue); - /// TimeOfTreatment. + /// Time of treatment. public static HealthcareEntityRelationType TimeOfTreatment { get; } = new HealthcareEntityRelationType(TimeOfTreatmentValue); - /// UnitOfCondition. + /// Unit of condition. public static HealthcareEntityRelationType UnitOfCondition { get; } = new HealthcareEntityRelationType(UnitOfConditionValue); - /// UnitOfExamination. + /// Unit of examination. public static HealthcareEntityRelationType UnitOfExamination { get; } = new HealthcareEntityRelationType(UnitOfExaminationValue); - /// ValueOfCondition. + /// Value of condition. public static HealthcareEntityRelationType ValueOfCondition { get; } = new HealthcareEntityRelationType(ValueOfConditionValue); - /// ValueOfExamination. + /// Value of examination. public static HealthcareEntityRelationType ValueOfExamination { get; } = new HealthcareEntityRelationType(ValueOfExaminationValue); - /// VariantOfGene. + /// Body site of condition. + public static HealthcareEntityRelationType BodySiteOfCondition { get; } = new HealthcareEntityRelationType(BodySiteOfConditionValue); + /// Body site of treatment. + public static HealthcareEntityRelationType BodySiteOfTreatment { get; } = new HealthcareEntityRelationType(BodySiteOfTreatmentValue); + /// Course of condition. + public static HealthcareEntityRelationType CourseOfCondition { get; } = new HealthcareEntityRelationType(CourseOfConditionValue); + /// Course of examination. + public static HealthcareEntityRelationType CourseOfExamination { get; } = new HealthcareEntityRelationType(CourseOfExaminationValue); + /// Course of medication. + public static HealthcareEntityRelationType CourseOfMedication { get; } = new HealthcareEntityRelationType(CourseOfMedicationValue); + /// Course of treatment. + public static HealthcareEntityRelationType CourseOfTreatment { get; } = new HealthcareEntityRelationType(CourseOfTreatmentValue); + /// Examination finds condition. + public static HealthcareEntityRelationType ExaminationFindsCondition { get; } = new HealthcareEntityRelationType(ExaminationFindsConditionValue); + /// Expression of gene. + public static HealthcareEntityRelationType ExpressionOfGene { get; } = new HealthcareEntityRelationType(ExpressionOfGeneValue); + /// Expression of variant. + public static HealthcareEntityRelationType ExpressionOfVariant { get; } = new HealthcareEntityRelationType(ExpressionOfVariantValue); + /// Frequency of condition. + public static HealthcareEntityRelationType FrequencyOfCondition { get; } = new HealthcareEntityRelationType(FrequencyOfConditionValue); + /// Mutation type of gene. + public static HealthcareEntityRelationType MutationTypeOfGene { get; } = new HealthcareEntityRelationType(MutationTypeOfGeneValue); + /// Mutation type of variant. + public static HealthcareEntityRelationType MutationTypeOfVariant { get; } = new HealthcareEntityRelationType(MutationTypeOfVariantValue); + /// Scale of condition. + public static HealthcareEntityRelationType ScaleOfCondition { get; } = new HealthcareEntityRelationType(ScaleOfConditionValue); + /// Variant of gene. public static HealthcareEntityRelationType VariantOfGene { get; } = new HealthcareEntityRelationType(VariantOfGeneValue); /// Determines if two values are the same. public static bool operator ==(HealthcareEntityRelationType left, HealthcareEntityRelationType right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.Serialization.cs index 0df65ab2cd5e..32d18de92013 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class HealthcareLROResult : IUtf8JsonSerializable + internal partial class HealthcareLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static HealthcareLROResult DeserializeHealthcareLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static HealthcareLROResult DeserializeHealthcareLROResult(JsonElement e return null; } HealthcareResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static HealthcareLROResult DeserializeHealthcareLROResult(JsonElement e results = HealthcareResult.DeserializeHealthcareResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new HealthcareLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new HealthcareLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static HealthcareLROResult DeserializeHealthcareLROResult(JsonElement e using var document = JsonDocument.Parse(response.Content); return DeserializeHealthcareLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.cs index 4b591f383115..411c15d52d18 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The HealthcareLROResult. + /// Healthcare Analyze Text long tunning operation result object. internal partial class HealthcareLROResult : AnalyzeTextLROResult { /// 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. - public HealthcareLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, HealthcareResult results) : base(lastUpdateDateTime, status) + internal HealthcareLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, HealthcareResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public HealthcareLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOpera } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal HealthcareLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, HealthcareResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// Results of the task. + internal HealthcareLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, HealthcareResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public HealthcareResult Results { get; set; } + /// Results of the task. + public HealthcareResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.Serialization.cs index 51742c2c2074..dd37b1493331 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static HealthcareLROTask DeserializeHealthcareLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - HealthcareTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = HealthcareTaskParameters.DeserializeHealthcareTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new HealthcareLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new HealthcareLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.cs index 601a6f154f06..ea78fe9dd538 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareLROTask.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The HealthcareLROTask. + /// The long running task to be performed by the service on the Healthcare input documents. internal partial class HealthcareLROTask : AnalyzeTextLROTask { /// Initializes a new instance of . @@ -17,16 +17,16 @@ public HealthcareLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a Healthcare task. + /// task name. + /// The kind of task to perform. + /// Parameters for the Healthcare task. internal HealthcareLROTask(string taskName, AnalyzeTextLROTaskKind kind, HealthcareTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a Healthcare task. + /// Parameters for the Healthcare task. public HealthcareTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.Serialization.cs index c635b5b90ebf..2a5571dfc559 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class HealthcareRelationEntity : IUtf8JsonSerializable + internal partial class HealthcareRelationEntity { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("ref"u8); - writer.WriteStringValue(Ref); - writer.WritePropertyName("role"u8); - writer.WriteStringValue(Role); - writer.WriteEndObject(); - } - internal static HealthcareRelationEntity DeserializeHealthcareRelationEntity(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,13 +42,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.cs index 341a6c26f37e..3a9ef9973cd8 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationEntity.cs @@ -9,14 +9,14 @@ namespace Azure.AI.TextAnalytics.Models { - /// The HealthcareRelationEntity. + /// Entity in the relation. internal partial class HealthcareRelationEntity { /// 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. - public HealthcareRelationEntity(string @ref, string role) + internal HealthcareRelationEntity(string @ref, string role) { Argument.AssertNotNull(@ref, nameof(@ref)); Argument.AssertNotNull(role, nameof(role)); @@ -26,8 +26,8 @@ public HealthcareRelationEntity(string @ref, string role) } /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . - public string Ref { get; set; } + 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; set; } + public string Role { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.Serialization.cs index ac44c5700283..e624c6fb5813 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.Serialization.cs @@ -7,32 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class HealthcareRelationInternal : IUtf8JsonSerializable + internal partial class HealthcareRelationInternal { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("relationType"u8); - writer.WriteStringValue(RelationType.ToString()); - if (Optional.IsDefined(ConfidenceScore)) - { - writer.WritePropertyName("confidenceScore"u8); - writer.WriteNumberValue(ConfidenceScore.Value); - } - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static HealthcareRelationInternal DeserializeHealthcareRelationInternal(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -40,8 +19,8 @@ internal static HealthcareRelationInternal DeserializeHealthcareRelationInternal return null; } HealthcareEntityRelationType relationType = default; + IReadOnlyList entities = default; double? confidenceScore = default; - IList entities = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("relationType"u8)) @@ -49,15 +28,6 @@ internal static HealthcareRelationInternal DeserializeHealthcareRelationInternal relationType = new HealthcareEntityRelationType(property.Value.GetString()); continue; } - if (property.NameEquals("confidenceScore"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - confidenceScore = property.Value.GetDouble(); - continue; - } if (property.NameEquals("entities"u8)) { List array = new List(); @@ -68,8 +38,17 @@ internal static HealthcareRelationInternal DeserializeHealthcareRelationInternal entities = array; continue; } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } } - return new HealthcareRelationInternal(relationType, confidenceScore, entities); + return new HealthcareRelationInternal(relationType, entities, confidenceScore); } /// Deserializes the model from a raw response. @@ -79,13 +58,5 @@ internal static HealthcareRelationInternal FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeHealthcareRelationInternal(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.cs index 66ea6478a09e..38dc0aacf3e5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareRelationInternal.cs @@ -18,7 +18,7 @@ internal partial class HealthcareRelationInternal /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. /// The entities in the relation. /// is null. - public HealthcareRelationInternal(HealthcareEntityRelationType relationType, IEnumerable entities) + internal HealthcareRelationInternal(HealthcareEntityRelationType relationType, IEnumerable entities) { Argument.AssertNotNull(entities, nameof(entities)); @@ -28,20 +28,20 @@ public HealthcareRelationInternal(HealthcareEntityRelationType relationType, IEn /// Initializes a new instance of . /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. - /// Confidence score between 0 and 1 of the extracted relation. /// The entities in the relation. - internal HealthcareRelationInternal(HealthcareEntityRelationType relationType, double? confidenceScore, IList entities) + /// Confidence score between 0 and 1 of the extracted relation. + internal HealthcareRelationInternal(HealthcareEntityRelationType relationType, IReadOnlyList entities, double? confidenceScore) { RelationType = relationType; - ConfidenceScore = confidenceScore; Entities = entities; + ConfidenceScore = confidenceScore; } /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. - public HealthcareEntityRelationType RelationType { get; set; } - /// Confidence score between 0 and 1 of the extracted relation. - public double? ConfidenceScore { get; set; } + public HealthcareEntityRelationType RelationType { get; } /// The entities in the relation. - public IList Entities { get; } + 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.TextAnalytics/src/Generated/Models/HealthcareResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.Serialization.cs index e5418b03278d..eae3f6e722b7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class HealthcareResult : IUtf8JsonSerializable + internal partial class HealthcareResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static HealthcareResult DeserializeHealthcareResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(HealthcareResultDocumentsItem.DeserializeHealthcareResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static HealthcareResult DeserializeHealthcareResult(JsonElement element modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntitiesDocumentResult.DeserializeHealthcareEntitiesDocumentResult(item)); + } + documents = array; + continue; + } } return new HealthcareResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new HealthcareResult FromResponse(Response response) + internal static HealthcareResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeHealthcareResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.cs index 3bfb87c96073..4936c352b180 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The HealthcareResult. - internal partial class HealthcareResult : PreBuiltResult + /// Result object for the processed Healthcare task. + internal partial class HealthcareResult { /// 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. - public HealthcareResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + 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(); } @@ -32,13 +34,22 @@ public HealthcareResult(IEnumerable errors, string modelVersion, /// 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. - /// - internal HealthcareResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + /// List of result objects for the processed Healthcare documents. + internal HealthcareResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } - /// Gets the documents. - public IList 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 TextDocumentBatchStatistics 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.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.Serialization.cs deleted file mode 100644 index 77f2ed8a23ad..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class HealthcareResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("relations"u8); - writer.WriteStartArray(); - foreach (var item in Relations) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static HealthcareResultDocumentsItem DeserializeHealthcareResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList entities = default; - IList relations = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(HealthcareEntityInternal.DeserializeHealthcareEntityInternal(item)); - } - entities = array; - continue; - } - if (property.NameEquals("relations"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(HealthcareRelationInternal.DeserializeHealthcareRelationInternal(item)); - } - relations = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new HealthcareResultDocumentsItem(id, warnings, statistics, entities, relations); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new HealthcareResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.cs deleted file mode 100644 index 720c0df1f6d7..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The HealthcareResultDocumentsItem. - internal partial class HealthcareResultDocumentsItem : HealthcareEntitiesDocumentResult - { - /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// Warnings encountered while processing document. - /// Healthcare entities. - /// Healthcare entity relations. - /// , , or is null. - public HealthcareResultDocumentsItem(string id, IEnumerable warnings, IEnumerable entities, IEnumerable relations) : base(id, warnings, entities, relations) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(entities, nameof(entities)); - Argument.AssertNotNull(relations, nameof(relations)); - } - - /// 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. - internal HealthcareResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, IList entities, IList relations) : base(id, warnings, statistics, entities, relations) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.Serialization.cs index 429b0da73052..95fafdbfc0c9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.Serialization.cs @@ -15,72 +15,26 @@ internal partial class HealthcareTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(StringIndexType)) + if (Optional.IsDefined(LoggingOptOut)) { - writer.WritePropertyName("stringIndexType"u8); - writer.WriteStringValue(StringIndexType.Value.ToString()); + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); } if (Optional.IsDefined(ModelVersion)) { writer.WritePropertyName("modelVersion"u8); writer.WriteStringValue(ModelVersion); } - if (Optional.IsDefined(LoggingOptOut)) + if (Optional.IsDefined(StringIndexType)) { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); } writer.WriteEndObject(); } - internal static HealthcareTaskParameters DeserializeHealthcareTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - StringIndexType? stringIndexType = default; - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("stringIndexType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - stringIndexType = new StringIndexType(property.Value.GetString()); - continue; - } - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new HealthcareTaskParameters(loggingOptOut, modelVersion, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new HealthcareTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeHealthcareTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.cs index fa8923ccbc35..f4c0084851b8 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Healthcare task. - internal partial class HealthcareTaskParameters : PreBuiltTaskParameters + internal partial class HealthcareTaskParameters { /// Initializes a new instance of . public HealthcareTaskParameters() @@ -16,15 +16,21 @@ public HealthcareTaskParameters() } /// Initializes a new instance of . - /// - /// - /// 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. - internal HealthcareTaskParameters(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType) : base(loggingOptOut, modelVersion) + /// logging opt out. + /// model version. + /// Specifies the method used to interpret string offsets. + internal HealthcareTaskParameters(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; StringIndexType = stringIndexType; } - /// 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. + /// 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; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorCode.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorCode.cs index 75a48383178c..e4a1e126c629 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorCode.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorCode.cs @@ -37,33 +37,33 @@ public InnerErrorCode(string value) private const string UnsupportedLanguageCodeValue = "UnsupportedLanguageCode"; private const string InvalidCountryHintValue = "InvalidCountryHint"; - /// InvalidRequest. + /// Invalid request error. public static InnerErrorCode InvalidRequest { get; } = new InnerErrorCode(InvalidRequestValue); - /// InvalidParameterValue. + /// Invalid parameter value error. public static InnerErrorCode InvalidParameterValue { get; } = new InnerErrorCode(InvalidParameterValueValue); - /// KnowledgeBaseNotFound. + /// Knowledge base not found error. public static InnerErrorCode KnowledgeBaseNotFound { get; } = new InnerErrorCode(KnowledgeBaseNotFoundValue); - /// AzureCognitiveSearchNotFound. + /// Azure Cognitive Search not found error. public static InnerErrorCode AzureCognitiveSearchNotFound { get; } = new InnerErrorCode(AzureCognitiveSearchNotFoundValue); - /// AzureCognitiveSearchThrottling. + /// Azure Cognitive Search throttling error. public static InnerErrorCode AzureCognitiveSearchThrottling { get; } = new InnerErrorCode(AzureCognitiveSearchThrottlingValue); - /// ExtractionFailure. + /// Extraction failure error. public static InnerErrorCode ExtractionFailure { get; } = new InnerErrorCode(ExtractionFailureValue); - /// InvalidRequestBodyFormat. + /// Invalid request body format error. public static InnerErrorCode InvalidRequestBodyFormat { get; } = new InnerErrorCode(InvalidRequestBodyFormatValue); - /// EmptyRequest. + /// Empty request error. public static InnerErrorCode EmptyRequest { get; } = new InnerErrorCode(EmptyRequestValue); - /// MissingInputDocuments. + /// Missing input documents error. public static InnerErrorCode MissingInputDocuments { get; } = new InnerErrorCode(MissingInputDocumentsValue); - /// InvalidDocument. + /// Invalid document error. public static InnerErrorCode InvalidDocument { get; } = new InnerErrorCode(InvalidDocumentValue); - /// ModelVersionIncorrect. + /// Model version incorrect error. public static InnerErrorCode ModelVersionIncorrect { get; } = new InnerErrorCode(ModelVersionIncorrectValue); - /// InvalidDocumentBatch. + /// Invalid document batch error. public static InnerErrorCode InvalidDocumentBatch { get; } = new InnerErrorCode(InvalidDocumentBatchValue); - /// UnsupportedLanguageCode. + /// Unsupported language code error. public static InnerErrorCode UnsupportedLanguageCode { get; } = new InnerErrorCode(UnsupportedLanguageCodeValue); - /// InvalidCountryHint. + /// 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); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.Serialization.cs index 56144a60ae57..6a14f433c52e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.Serialization.cs @@ -7,43 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class InnerErrorModel : IUtf8JsonSerializable + internal partial class InnerErrorModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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); - } - writer.WriteEndObject(); - } - internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -52,7 +20,7 @@ internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element) } InnerErrorCode code = default; string message = default; - IDictionary details = default; + IReadOnlyDictionary details = default; string target = default; InnerErrorModel innererror = default; foreach (var property in element.EnumerateObject()) @@ -106,13 +74,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.cs index 14db7cffe467..c58ce7c62375 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/InnerErrorModel.cs @@ -17,7 +17,7 @@ internal partial class InnerErrorModel /// One of a server-defined set of error codes. /// Error message. /// is null. - public InnerErrorModel(InnerErrorCode code, string message) + internal InnerErrorModel(InnerErrorCode code, string message) { Argument.AssertNotNull(message, nameof(message)); @@ -32,7 +32,7 @@ public InnerErrorModel(InnerErrorCode code, string message) /// Error details. /// Error target. /// An object containing more specific information than the current object about the error. - internal InnerErrorModel(InnerErrorCode code, string message, IDictionary details, string target, InnerErrorModel innererror) + internal InnerErrorModel(InnerErrorCode code, string message, IReadOnlyDictionary details, string target, InnerErrorModel innererror) { Code = code; Message = message; @@ -42,14 +42,14 @@ internal InnerErrorModel(InnerErrorCode code, string message, IDictionary One of a server-defined set of error codes. - public InnerErrorCode Code { get; set; } + public InnerErrorCode Code { get; } /// Error message. - public string Message { get; set; } + public string Message { get; } /// Error details. - public IDictionary Details { get; } + public IReadOnlyDictionary Details { get; } /// Error target. - public string Target { get; set; } + public string Target { get; } /// An object containing more specific information than the current object about the error. - public InnerErrorModel Innererror { get; set; } + public InnerErrorModel Innererror { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobErrors.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobErrors.cs deleted file mode 100644 index d000ff1df73c..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobErrors.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The JobErrors. - internal partial class JobErrors - { - /// Initializes a new instance of . - internal JobErrors() - { - Errors = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - internal JobErrors(IReadOnlyList errors) - { - Errors = errors; - } - - /// Gets the errors. - public IReadOnlyList Errors { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.Serialization.cs deleted file mode 100644 index 5a946ceda3e8..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.Serialization.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Text.Json; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class JobState - { - internal static JobState DeserializeJobState(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string displayName = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? expirationDateTime = default; - string jobId = default; - DateTimeOffset lastUpdatedDateTime = default; - TextAnalyticsOperationStatus status = default; - IReadOnlyList errors = default; - string nextLink = default; - 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.GetString(); - continue; - } - if (property.NameEquals("lastUpdatedDateTime"u8)) - { - lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new TextAnalyticsOperationStatus(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(Error.DeserializeError(item)); - } - errors = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new JobState( - displayName, - createdDateTime, - expirationDateTime, - jobId, - lastUpdatedDateTime, - status, - errors ?? new ChangeTrackingList(), - nextLink); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static JobState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeJobState(document.RootElement); - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.cs deleted file mode 100644 index 3c49287162cb..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The JobState. - internal partial class JobState - { - /// Initializes a new instance of . - /// - /// - /// - /// - /// is null. - internal JobState(DateTimeOffset createdDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, TextAnalyticsOperationStatus status) - { - Argument.AssertNotNull(jobId, nameof(jobId)); - - CreatedDateTime = createdDateTime; - JobId = jobId; - LastUpdatedDateTime = lastUpdatedDateTime; - Status = status; - Errors = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - /// - /// - /// - /// - /// - /// - /// - internal JobState(string displayName, DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, string jobId, DateTimeOffset lastUpdatedDateTime, TextAnalyticsOperationStatus status, IReadOnlyList errors, string nextLink) - { - DisplayName = displayName; - CreatedDateTime = createdDateTime; - ExpirationDateTime = expirationDateTime; - JobId = jobId; - LastUpdatedDateTime = lastUpdatedDateTime; - Status = status; - Errors = errors; - NextLink = nextLink; - } - - /// Gets the display name. - public string DisplayName { get; } - /// Gets the created date time. - public DateTimeOffset CreatedDateTime { get; } - /// Gets the expiration date time. - public DateTimeOffset? ExpirationDateTime { get; } - /// Gets the job id. - public string JobId { get; } - /// Gets the last updated date time. - public DateTimeOffset LastUpdatedDateTime { get; } - /// Gets the status. - public TextAnalyticsOperationStatus Status { get; } - /// Gets the errors. - public IReadOnlyList Errors { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.Serialization.cs index 4707ac690712..391531baf2d2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class KeyPhraseExtractionLROResult : IUtf8JsonSerializable + internal partial class KeyPhraseExtractionLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static KeyPhraseExtractionLROResult DeserializeKeyPhraseExtractionLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static KeyPhraseExtractionLROResult DeserializeKeyPhraseExtractionLRORe return null; } KeyPhraseResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static KeyPhraseExtractionLROResult DeserializeKeyPhraseExtractionLRORe results = KeyPhraseResult.DeserializeKeyPhraseResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new KeyPhraseExtractionLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new KeyPhraseExtractionLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static KeyPhraseExtractionLROResult DeserializeKeyPhraseExtractionLRORe using var document = JsonDocument.Parse(response.Content); return DeserializeKeyPhraseExtractionLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.cs index 0495e8e0d39c..e5dd728041ef 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseExtractionLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The KeyPhraseExtractionLROResult. + /// Contains the analyze text KeyPhraseExtraction LRO task. internal partial class KeyPhraseExtractionLROResult : AnalyzeTextLROResult { /// 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. - public KeyPhraseExtractionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, KeyPhraseResult results) : base(lastUpdateDateTime, status) + internal KeyPhraseExtractionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, KeyPhraseResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public KeyPhraseExtractionLROResult(DateTimeOffset lastUpdateDateTime, TextAnaly } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal KeyPhraseExtractionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, KeyPhraseResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// The list of Key phrase extraction results. + internal KeyPhraseExtractionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, KeyPhraseResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public KeyPhraseResult Results { get; set; } + /// The list of Key phrase extraction results. + public KeyPhraseResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.Serialization.cs index 9a18b1cdec2c..7c3df0a2da3f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static KeyPhraseLROTask DeserializeKeyPhraseLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - KeyPhraseTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = KeyPhraseTaskParameters.DeserializeKeyPhraseTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new KeyPhraseLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new KeyPhraseLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyPhraseLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.cs index 3eefccf80f41..902348de6166 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseLROTask.cs @@ -17,16 +17,16 @@ public KeyPhraseLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a Key Phrase Extraction task. + /// task name. + /// The kind of task to perform. + /// Key phrase extraction task parameters. internal KeyPhraseLROTask(string taskName, AnalyzeTextLROTaskKind kind, KeyPhraseTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a Key Phrase Extraction task. + /// Key phrase extraction task parameters. public KeyPhraseTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.Serialization.cs index 87a229594758..96986895ab3d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class KeyPhraseResult : IUtf8JsonSerializable + internal partial class KeyPhraseResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static KeyPhraseResult DeserializeKeyPhraseResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(KeyPhraseResultDocumentsItem.DeserializeKeyPhraseResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static KeyPhraseResult DeserializeKeyPhraseResult(JsonElement element) modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KeyPhrasesDocumentResult.DeserializeKeyPhrasesDocumentResult(item)); + } + documents = array; + continue; + } } return new KeyPhraseResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new KeyPhraseResult FromResponse(Response response) + internal static KeyPhraseResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeKeyPhraseResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.cs index be4b64fa6a23..e44cbe2ea1c0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The KeyPhraseResult. - internal partial class KeyPhraseResult : PreBuiltResult + /// Contains the KeyPhraseResult. + internal partial class KeyPhraseResult { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. /// Response by document. /// , or is null. - public KeyPhraseResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + 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(); } @@ -33,12 +35,21 @@ public KeyPhraseResult(IEnumerable errors, string modelVersion, I /// 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. - internal KeyPhraseResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + internal KeyPhraseResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } + /// 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 TextDocumentBatchStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } /// Response by document. - public IList Documents { get; } + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.Serialization.cs deleted file mode 100644 index 43f521b57ded..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class KeyPhraseResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("keyPhrases"u8); - writer.WriteStartArray(); - foreach (var item in KeyPhrases) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static KeyPhraseResultDocumentsItem DeserializeKeyPhraseResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList keyPhrases = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - 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("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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new KeyPhraseResultDocumentsItem(id, warnings, statistics, keyPhrases); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new KeyPhraseResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyPhraseResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.cs deleted file mode 100644 index 8fd9f64c8038..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The KeyPhraseResultDocumentsItem. - internal partial class KeyPhraseResultDocumentsItem : KeyPhrasesDocumentResult - { - /// 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. - public KeyPhraseResultDocumentsItem(string id, IEnumerable warnings, IEnumerable keyPhrases) : base(id, warnings, keyPhrases) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(keyPhrases, nameof(keyPhrases)); - } - - /// 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. - internal KeyPhraseResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, IList keyPhrases) : base(id, warnings, statistics, keyPhrases) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.Serialization.cs index 781004f9a279..8533f567e7c0 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.Serialization.cs @@ -15,57 +15,21 @@ internal partial class KeyPhraseTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } if (Optional.IsDefined(LoggingOptOut)) { writer.WritePropertyName("loggingOptOut"u8); writer.WriteBooleanValue(LoggingOptOut.Value); } - writer.WriteEndObject(); - } - - internal static KeyPhraseTaskParameters DeserializeKeyPhraseTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) + if (Optional.IsDefined(ModelVersion)) { - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); } - return new KeyPhraseTaskParameters(loggingOptOut, modelVersion); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new KeyPhraseTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeKeyPhraseTaskParameters(document.RootElement); + writer.WriteEndObject(); } /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.cs index 2f6e46625b59..9914ada47ea7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Key Phrase Extraction task. - internal partial class KeyPhraseTaskParameters : PreBuiltTaskParameters + internal partial class KeyPhraseTaskParameters { /// Initializes a new instance of . public KeyPhraseTaskParameters() @@ -16,10 +16,17 @@ public KeyPhraseTaskParameters() } /// Initializes a new instance of . - /// - /// - internal KeyPhraseTaskParameters(bool? loggingOptOut, string modelVersion) : base(loggingOptOut, modelVersion) + /// logging opt out. + /// model version. + internal KeyPhraseTaskParameters(bool? loggingOptOut, string modelVersion) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskResult.cs index ad15c30cbf9d..297f599ca320 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseTaskResult.cs @@ -9,11 +9,11 @@ namespace Azure.AI.TextAnalytics.Models { - /// The KeyPhraseTaskResult. + /// Contains the analyze text KeyPhraseExtraction task result. internal partial class KeyPhraseTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// + /// The list of Key phrase extraction results. /// is null. internal KeyPhraseTaskResult(KeyPhraseResult results) { @@ -24,15 +24,15 @@ internal KeyPhraseTaskResult(KeyPhraseResult results) } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. - /// + /// The kind of task result. + /// The list of Key phrase extraction results. internal KeyPhraseTaskResult(AnalyzeTextTaskResultsKind kind, KeyPhraseResult results) : base(kind) { Results = results; Kind = kind; } - /// Gets the results. + /// The list of Key phrase extraction results. public KeyPhraseResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.Serialization.cs index 8998948837e0..e9e7c069f0c9 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class KeyPhrasesDocumentResult : IUtf8JsonSerializable + internal partial class KeyPhrasesDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("keyPhrases"u8); - writer.WriteStartArray(); - foreach (var item in KeyPhrases) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static KeyPhrasesDocumentResult DeserializeKeyPhrasesDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList keyPhrases = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList keyPhrases = default; foreach (var property in element.EnumerateObject()) { - 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("id"u8)) { id = property.Value.GetString(); @@ -86,24 +48,26 @@ internal static KeyPhrasesDocumentResult DeserializeKeyPhrasesDocumentResult(Jso statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("keyPhrases"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + keyPhrases = array; + continue; + } } return new KeyPhrasesDocumentResult(id, warnings, statistics, keyPhrases); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new KeyPhrasesDocumentResult FromResponse(Response response) + internal static KeyPhrasesDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeKeyPhrasesDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.cs index 27028fba1dc9..7016316f01b7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhrasesDocumentResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The KeyPhrasesDocumentResult. - internal partial class KeyPhrasesDocumentResult : DocumentResult + /// Contains the Key phrase extraction results for a document. + internal partial class KeyPhrasesDocumentResult { /// 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. - public KeyPhrasesDocumentResult(string id, IEnumerable warnings, IEnumerable keyPhrases) : base(id, warnings) + internal KeyPhrasesDocumentResult(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(); } @@ -33,12 +35,21 @@ public KeyPhrasesDocumentResult(string id, IEnumerable warnings /// 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. - internal KeyPhrasesDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList keyPhrases) : base(id, warnings, statistics) + internal KeyPhrasesDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList keyPhrases) { + Id = id; + Warnings = warnings; + Statistics = statistics; KeyPhrases = keyPhrases; } + /// 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 TextDocumentStatistics? 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 IList KeyPhrases { get; } + public IReadOnlyList KeyPhrases { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionAnalysisInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionAnalysisInput.cs index 07c2d5d4862c..434edbe48383 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionAnalysisInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionAnalysisInput.cs @@ -9,7 +9,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The LanguageDetectionAnalysisInput. + /// Contains the language detection document analysis input. internal partial class LanguageDetectionAnalysisInput { /// Initializes a new instance of . @@ -19,13 +19,13 @@ public LanguageDetectionAnalysisInput() } /// Initializes a new instance of . - /// + /// List of documents to be analyzed. internal LanguageDetectionAnalysisInput(IList documents) { Documents = documents; } - /// Gets the documents. + /// List of documents to be analyzed. public IList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs index 67a7e4b678ee..0407221003f5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs @@ -7,51 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class LanguageDetectionDocumentResult : IUtf8JsonSerializable + internal partial class LanguageDetectionDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("detectedLanguage"u8); - writer.WriteObjectValue(DetectedLanguage); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static LanguageDetectionDocumentResult DeserializeLanguageDetectionDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - DetectedLanguageInternal detectedLanguage = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + DetectedLanguageInternal detectedLanguage = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("detectedLanguage"u8)) - { - detectedLanguage = DetectedLanguageInternal.DeserializeDetectedLanguageInternal(property.Value); - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -76,24 +48,21 @@ internal static LanguageDetectionDocumentResult DeserializeLanguageDetectionDocu statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("detectedLanguage"u8)) + { + detectedLanguage = DetectedLanguageInternal.DeserializeDetectedLanguageInternal(property.Value); + continue; + } } return new LanguageDetectionDocumentResult(id, warnings, statistics, detectedLanguage); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new LanguageDetectionDocumentResult FromResponse(Response response) + internal static LanguageDetectionDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeLanguageDetectionDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.cs index 4634a8485eed..7931800b922d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionDocumentResult.cs @@ -7,22 +7,25 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.AI.TextAnalytics.Models { - /// The LanguageDetectionDocumentResult. - internal partial class LanguageDetectionDocumentResult : DocumentResult + /// Contains the language detection for a document. + internal partial class LanguageDetectionDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. /// Warnings encountered while processing document. /// Detected Language. /// or is null. - public LanguageDetectionDocumentResult(string id, IEnumerable warnings, DetectedLanguageInternal detectedLanguage) : base(id, warnings) + internal LanguageDetectionDocumentResult(string id, IEnumerable warnings, DetectedLanguageInternal detectedLanguage) { Argument.AssertNotNull(id, nameof(id)); Argument.AssertNotNull(warnings, nameof(warnings)); + Id = id; + Warnings = warnings.ToList(); DetectedLanguage = detectedLanguage; } @@ -31,12 +34,21 @@ public LanguageDetectionDocumentResult(string id, IEnumerable w /// Warnings encountered while processing document. /// if showStats=true was specified in the request this field will contain information about the document payload. /// Detected Language. - internal LanguageDetectionDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, DetectedLanguageInternal detectedLanguage) : base(id, warnings, statistics) + internal LanguageDetectionDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, DetectedLanguageInternal detectedLanguage) { + Id = id; + Warnings = warnings; + Statistics = statistics; DetectedLanguage = detectedLanguage; } + /// 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 TextDocumentStatistics? Statistics { get; } /// Detected Language. - public DetectedLanguageInternal DetectedLanguage { get; set; } + public DetectedLanguageInternal DetectedLanguage { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.Serialization.cs index 7c6064b09af8..65c4797bd555 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class LanguageDetectionResult : IUtf8JsonSerializable + internal partial class LanguageDetectionResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static LanguageDetectionResult DeserializeLanguageDetectionResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(LanguageDetectionDocumentResult.DeserializeLanguageDetectionDocumentResult(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static LanguageDetectionResult DeserializeLanguageDetectionResult(JsonE 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)); + } + documents = array; + continue; + } } return new LanguageDetectionResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new LanguageDetectionResult FromResponse(Response response) + internal static LanguageDetectionResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeLanguageDetectionResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.cs index e4093356bfc1..9e22b7df2601 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The LanguageDetectionResult. - internal partial class LanguageDetectionResult : PreBuiltResult + /// Contains the language detection result for the request. + internal partial class LanguageDetectionResult { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. - /// Response by document. + /// Enumeration of language detection results for each input document. /// , or is null. - public LanguageDetectionResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + 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(); } @@ -32,13 +34,22 @@ public LanguageDetectionResult(IEnumerable errors, string modelVe /// 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. - internal LanguageDetectionResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + /// Enumeration of language detection results for each input document. + internal LanguageDetectionResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } - /// Response by document. - public IList 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 TextDocumentBatchStatistics 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.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.Serialization.cs index d89965fe92e2..06a8a295ed49 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.Serialization.cs @@ -15,57 +15,21 @@ internal partial class LanguageDetectionTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } if (Optional.IsDefined(LoggingOptOut)) { writer.WritePropertyName("loggingOptOut"u8); writer.WriteBooleanValue(LoggingOptOut.Value); } - writer.WriteEndObject(); - } - - internal static LanguageDetectionTaskParameters DeserializeLanguageDetectionTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) + if (Optional.IsDefined(ModelVersion)) { - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); } - return new LanguageDetectionTaskParameters(loggingOptOut, modelVersion); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new LanguageDetectionTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeLanguageDetectionTaskParameters(document.RootElement); + writer.WriteEndObject(); } /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.cs index 59805e47ffac..704b7e30d4d6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Language Detection task. - internal partial class LanguageDetectionTaskParameters : PreBuiltTaskParameters + internal partial class LanguageDetectionTaskParameters { /// Initializes a new instance of . public LanguageDetectionTaskParameters() @@ -16,10 +16,17 @@ public LanguageDetectionTaskParameters() } /// Initializes a new instance of . - /// - /// - internal LanguageDetectionTaskParameters(bool? loggingOptOut, string modelVersion) : base(loggingOptOut, modelVersion) + /// logging opt out. + /// model version. + internal LanguageDetectionTaskParameters(bool? loggingOptOut, string modelVersion) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskResult.cs index 6818652cc988..deb049dca54f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageDetectionTaskResult.cs @@ -9,11 +9,11 @@ namespace Azure.AI.TextAnalytics.Models { - /// The LanguageDetectionTaskResult. + /// Contains the language detection task result for the request. internal partial class LanguageDetectionTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// + /// Contains the language detection results. /// is null. internal LanguageDetectionTaskResult(LanguageDetectionResult results) { @@ -24,15 +24,15 @@ internal LanguageDetectionTaskResult(LanguageDetectionResult results) } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. - /// + /// The kind of task result. + /// Contains the language detection results. internal LanguageDetectionTaskResult(AnalyzeTextTaskResultsKind kind, LanguageDetectionResult results) : base(kind) { Results = results; Kind = kind; } - /// Gets the results. + /// Contains the language detection results. public LanguageDetectionResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageInput.cs index fb2c67168827..96888c6691fc 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LanguageInput.cs @@ -7,12 +7,12 @@ namespace Azure.AI.TextAnalytics.Models { - /// The LanguageInput. + /// Contains the language detection input. internal partial class LanguageInput { /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// + /// A unique, non-empty document identifier. + /// The input text to process. public LanguageInput(string id, string text) { Id = id; @@ -20,9 +20,9 @@ public LanguageInput(string id, string text) } /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// - /// + /// A unique, non-empty document identifier. + /// The input text to process. + /// The country hint to help with language detection of the text. internal LanguageInput(string id, string text, string countryHint) { Id = id; @@ -30,11 +30,11 @@ internal LanguageInput(string id, string text, string countryHint) CountryHint = countryHint; } - /// Unique, non-empty document identifier. + /// A unique, non-empty document identifier. public string Id { get; } - /// Gets the text. + /// The input text to process. public string Text { get; } - /// Gets or sets the country hint. + /// The country hint to help with language detection of the text. public string CountryHint { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.Serialization.cs index 785a0b775096..0de3528c8f1e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class LinkedEntitiesDocumentResult : IUtf8JsonSerializable + internal partial class LinkedEntitiesDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static LinkedEntitiesDocumentResult DeserializeLinkedEntitiesDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList entities = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + IReadOnlyList entities = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("entities"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(LinkedEntity.DeserializeLinkedEntity(item)); - } - entities = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -86,24 +48,26 @@ internal static LinkedEntitiesDocumentResult DeserializeLinkedEntitiesDocumentRe statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LinkedEntity.DeserializeLinkedEntity(item)); + } + entities = array; + continue; + } } return new LinkedEntitiesDocumentResult(id, warnings, statistics, entities); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new LinkedEntitiesDocumentResult FromResponse(Response response) + internal static LinkedEntitiesDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeLinkedEntitiesDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.cs index 424d0a3f02bf..8fefd4d13cad 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntitiesDocumentResult.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The LinkedEntitiesDocumentResult. - internal partial class LinkedEntitiesDocumentResult : DocumentResult + /// Entity linking document result. + internal partial class LinkedEntitiesDocumentResult { /// 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. - public LinkedEntitiesDocumentResult(string id, IEnumerable warnings, IEnumerable entities) : base(id, warnings) + internal LinkedEntitiesDocumentResult(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(); } @@ -33,12 +35,21 @@ public LinkedEntitiesDocumentResult(string id, IEnumerable warn /// 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. - internal LinkedEntitiesDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, IList entities) : base(id, warnings, statistics) + internal LinkedEntitiesDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, IReadOnlyList entities) { + Id = id; + Warnings = warnings; + Statistics = statistics; Entities = entities; } + /// 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 TextDocumentStatistics? Statistics { get; } /// Recognized well known entities in the document. - public IList Entities { get; } + public IReadOnlyList Entities { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs index 7b13319e23d4..dee74d102e1b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.Serialization.cs @@ -8,43 +8,11 @@ using System; using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics { - public partial struct LinkedEntity : IUtf8JsonSerializable + public partial struct LinkedEntity { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("matches"u8); - writer.WriteStartArray(); - foreach (var item in Matches) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("language"u8); - writer.WriteStringValue(Language); - if (Optional.IsDefined(DataSourceEntityId)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(DataSourceEntityId); - } - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url.AbsoluteUri); - writer.WritePropertyName("dataSource"u8); - writer.WriteStringValue(DataSource); - if (Optional.IsDefined(BingEntitySearchApiId)) - { - writer.WritePropertyName("bingId"u8); - writer.WriteStringValue(BingEntitySearchApiId); - } - writer.WriteEndObject(); - } - internal static LinkedEntity DeserializeLinkedEntity(JsonElement element) { string name = default; @@ -114,13 +82,5 @@ internal static LinkedEntity FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeLinkedEntity(document.RootElement); } - - /// Convert into a . - internal RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.cs index 9778691e8590..a361b623b453 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntity.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics { - /// The LinkedEntity. + /// The LinkedEntity object containing the detected entity with the associated sources/links. public readonly partial struct LinkedEntity { } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.Serialization.cs index c21939075e3b..27b9d15b17ca 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.Serialization.cs @@ -6,26 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics { - public partial struct LinkedEntityMatch : IUtf8JsonSerializable + public partial struct LinkedEntityMatch { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - 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); - writer.WriteEndObject(); - } - internal static LinkedEntityMatch DeserializeLinkedEntityMatch(JsonElement element) { double confidenceScore = default; @@ -65,13 +50,5 @@ internal static LinkedEntityMatch FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeLinkedEntityMatch(document.RootElement); } - - /// Convert into a . - internal RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.cs index bd4359681535..890cd4598bf3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/LinkedEntityMatch.cs @@ -9,7 +9,7 @@ namespace Azure.AI.TextAnalytics { - /// The Match. + /// The Match object containing the detected entity text with the offset and the length. public readonly partial struct LinkedEntityMatch { } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageAnalysisInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageAnalysisInput.cs index 66d3dbeb8d49..7faca36a6cb7 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageAnalysisInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageAnalysisInput.cs @@ -9,7 +9,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The MultiLanguageAnalysisInput. + /// Collection of input documents to be analyzed by the service. internal partial class MultiLanguageAnalysisInput { /// Initializes a new instance of . @@ -19,13 +19,13 @@ public MultiLanguageAnalysisInput() } /// Initializes a new instance of . - /// + /// The input documents to be analyzed. internal MultiLanguageAnalysisInput(IList documents) { Documents = documents; } - /// Gets the documents. + /// The input documents to be analyzed. public IList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageInput.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageInput.cs index aec998c4fee6..e453f3e4477a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageInput.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/MultiLanguageInput.cs @@ -22,7 +22,7 @@ public MultiLanguageInput(string id, string 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. + /// (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. internal MultiLanguageInput(string id, string text, string language) { Id = id; @@ -34,7 +34,7 @@ internal MultiLanguageInput(string id, string text, string language) 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. + /// (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.TextAnalytics/src/Generated/Models/Pagination.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Pagination.cs deleted file mode 100644 index e6624237d38e..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Pagination.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// The Pagination. - internal partial class Pagination - { - /// Initializes a new instance of . - internal Pagination() - { - } - - /// Initializes a new instance of . - /// - internal Pagination(string nextLink) - { - NextLink = nextLink; - } - - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiDomain.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiDomain.cs index 08b08b97cb36..29f886d4b538 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiDomain.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiDomain.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// The PII domain used for PII Entity Recognition. + /// Domain for PII task. internal readonly partial struct PiiDomain : IEquatable { private readonly string _value; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.Serialization.cs index 1fef163b5813..239f1af34b71 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.Serialization.cs @@ -7,69 +7,24 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class PiiEntitiesDocumentResult : IUtf8JsonSerializable + internal partial class PiiEntitiesDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("redactedText"u8); - writer.WriteStringValue(RedactedText); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static PiiEntitiesDocumentResult DeserializePiiEntitiesDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - string redactedText = default; - IList entities = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + string redactedText = default; + IReadOnlyList entities = default; foreach (var property in element.EnumerateObject()) { - 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(Entity.DeserializeEntity(item)); - } - entities = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -94,24 +49,31 @@ internal static PiiEntitiesDocumentResult DeserializePiiEntitiesDocumentResult(J statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); 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(Entity.DeserializeEntity(item)); + } + entities = array; + continue; + } } return new PiiEntitiesDocumentResult(id, warnings, statistics, redactedText, entities); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new PiiEntitiesDocumentResult FromResponse(Response response) + internal static PiiEntitiesDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializePiiEntitiesDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.cs index 60f03b9349c0..7afd45282fcf 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesDocumentResult.cs @@ -11,8 +11,8 @@ namespace Azure.AI.TextAnalytics.Models { - /// The PiiEntitiesDocumentResult. - internal partial class PiiEntitiesDocumentResult : DocumentResult + /// Contains the PII results. + internal partial class PiiEntitiesDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. @@ -20,13 +20,15 @@ internal partial class PiiEntitiesDocumentResult : DocumentResult /// Returns redacted text. /// Recognized entities in the document. /// , , or is null. - public PiiEntitiesDocumentResult(string id, IEnumerable warnings, string redactedText, IEnumerable entities) : base(id, warnings) + internal PiiEntitiesDocumentResult(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(); } @@ -37,15 +39,24 @@ public PiiEntitiesDocumentResult(string id, IEnumerable warning /// 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. - internal PiiEntitiesDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, string redactedText, IList entities) : base(id, warnings, statistics) + internal PiiEntitiesDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, string redactedText, IReadOnlyList entities) { + Id = id; + Warnings = warnings; + Statistics = statistics; RedactedText = redactedText; Entities = entities; } + /// 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 TextDocumentStatistics? Statistics { get; } /// Returns redacted text. - public string RedactedText { get; set; } + public string RedactedText { get; } /// Recognized entities in the document. - public IList Entities { get; } + public IReadOnlyList Entities { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.Serialization.cs index 0a21a9c0693e..f5ba7b2d02c2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.Serialization.cs @@ -8,61 +8,23 @@ using System.Collections.Generic; using System.Text.Json; using Azure.AI.TextAnalytics.Models; -using Azure.Core; namespace Azure.AI.TextAnalytics { - internal partial class PiiEntitiesResult : IUtf8JsonSerializable + internal partial class PiiEntitiesResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static PiiEntitiesResult DeserializePiiEntitiesResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(PiiResultDocumentsItem.DeserializePiiResultDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -87,24 +49,26 @@ internal static PiiEntitiesResult DeserializePiiEntitiesResult(JsonElement eleme modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PiiEntitiesDocumentResult.DeserializePiiEntitiesDocumentResult(item)); + } + documents = array; + continue; + } } return new PiiEntitiesResult(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new PiiEntitiesResult FromResponse(Response response) + internal static PiiEntitiesResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializePiiEntitiesResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.cs index ca87d6353d0f..49a08ff413c6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntitiesResult.cs @@ -12,20 +12,22 @@ namespace Azure.AI.TextAnalytics { - /// The PiiResult. - internal partial class PiiEntitiesResult : PreBuiltResult + /// Contains the PiiResult. + internal partial class PiiEntitiesResult { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. /// Response by document. /// , or is null. - public PiiEntitiesResult(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + internal PiiEntitiesResult(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(); } @@ -34,12 +36,21 @@ public PiiEntitiesResult(IEnumerable errors, string modelVersion, /// 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. - internal PiiEntitiesResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + internal PiiEntitiesResult(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } + /// 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 TextDocumentBatchStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } /// Response by document. - public IList Documents { get; } + public IReadOnlyList Documents { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityCategory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityCategory.cs index 4197341f674c..d923144968eb 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityCategory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityCategory.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics { - /// The PiiCategory. + /// (Optional) describes the PII categories to return. public readonly partial struct PiiEntityCategory : IEquatable { private readonly string _value; @@ -196,329 +196,329 @@ public PiiEntityCategory(string value) private const string AllValue = "All"; private const string DefaultValue = "Default"; - /// ABARoutingNumber. + /// ABA Routing number. public static PiiEntityCategory ABARoutingNumber { get; } = new PiiEntityCategory(ABARoutingNumberValue); - /// ARNationalIdentityNumber. + /// AR National Identity Number. public static PiiEntityCategory ARNationalIdentityNumber { get; } = new PiiEntityCategory(ARNationalIdentityNumberValue); - /// AUBankAccountNumber. + /// AT Identity Card. public static PiiEntityCategory AUBankAccountNumber { get; } = new PiiEntityCategory(AUBankAccountNumberValue); - /// AUDriversLicenseNumber. + /// AU Driver's License Number. public static PiiEntityCategory AUDriversLicenseNumber { get; } = new PiiEntityCategory(AUDriversLicenseNumberValue); - /// AUMedicalAccountNumber. + /// AU Medical Account Number. public static PiiEntityCategory AUMedicalAccountNumber { get; } = new PiiEntityCategory(AUMedicalAccountNumberValue); - /// AUPassportNumber. + /// AU Passport Number. public static PiiEntityCategory AUPassportNumber { get; } = new PiiEntityCategory(AUPassportNumberValue); - /// AUTaxFileNumber. + /// AU Tax File Number. public static PiiEntityCategory AUTaxFileNumber { get; } = new PiiEntityCategory(AUTaxFileNumberValue); - /// AUBusinessNumber. + /// AU Business Number. public static PiiEntityCategory AUBusinessNumber { get; } = new PiiEntityCategory(AUBusinessNumberValue); - /// AUCompanyNumber. + /// AU Company Number. public static PiiEntityCategory AUCompanyNumber { get; } = new PiiEntityCategory(AUCompanyNumberValue); - /// ATIdentityCard. + /// AT Identity Card. public static PiiEntityCategory ATIdentityCard { get; } = new PiiEntityCategory(ATIdentityCardValue); - /// ATTaxIdentificationNumber. + /// AT Tax Identification Number. public static PiiEntityCategory ATTaxIdentificationNumber { get; } = new PiiEntityCategory(ATTaxIdentificationNumberValue); - /// ATValueAddedTaxNumber. + /// AT Value Added Tax Number. public static PiiEntityCategory ATValueAddedTaxNumber { get; } = new PiiEntityCategory(ATValueAddedTaxNumberValue); - /// AzureDocumentDBAuthKey. + /// Azure Document DB Auth Key. public static PiiEntityCategory AzureDocumentDBAuthKey { get; } = new PiiEntityCategory(AzureDocumentDBAuthKeyValue); - /// AzureIAASDatabaseConnectionAndSQLString. + /// Azure IAAS Database Connection And SQL String. public static PiiEntityCategory AzureIaasDatabaseConnectionAndSQLString { get; } = new PiiEntityCategory(AzureIaasDatabaseConnectionAndSQLStringValue); - /// AzureIoTConnectionString. + /// Azure IoT Connection String. public static PiiEntityCategory AzureIoTConnectionString { get; } = new PiiEntityCategory(AzureIoTConnectionStringValue); - /// AzurePublishSettingPassword. + /// Azure Publish Setting Password. public static PiiEntityCategory AzurePublishSettingPassword { get; } = new PiiEntityCategory(AzurePublishSettingPasswordValue); - /// AzureRedisCacheString. + /// Azure Redis Cache String. public static PiiEntityCategory AzureRedisCacheString { get; } = new PiiEntityCategory(AzureRedisCacheStringValue); - /// AzureSAS. + /// Azure SAS. public static PiiEntityCategory AzureSAS { get; } = new PiiEntityCategory(AzureSASValue); - /// AzureServiceBusString. + /// Azure Service Bus String. public static PiiEntityCategory AzureServiceBusString { get; } = new PiiEntityCategory(AzureServiceBusStringValue); - /// AzureStorageAccountKey. + /// Azure Storage Account Key. public static PiiEntityCategory AzureStorageAccountKey { get; } = new PiiEntityCategory(AzureStorageAccountKeyValue); - /// AzureStorageAccountGeneric. + /// Azure Storage Account Generic. public static PiiEntityCategory AzureStorageAccountGeneric { get; } = new PiiEntityCategory(AzureStorageAccountGenericValue); - /// BENationalNumber. + /// BE National Number. public static PiiEntityCategory BENationalNumber { get; } = new PiiEntityCategory(BENationalNumberValue); - /// BENationalNumberV2. + /// BE National Number V2. public static PiiEntityCategory BENationalNumberV2 { get; } = new PiiEntityCategory(BENationalNumberV2Value); - /// BEValueAddedTaxNumber. + /// BE Value Added Tax Number. public static PiiEntityCategory BEValueAddedTaxNumber { get; } = new PiiEntityCategory(BEValueAddedTaxNumberValue); - /// BRCPFNumber. + /// BR CPF Number. public static PiiEntityCategory BrcpfNumber { get; } = new PiiEntityCategory(BrcpfNumberValue); - /// BRLegalEntityNumber. + /// BR Legal Entity Number. public static PiiEntityCategory BRLegalEntityNumber { get; } = new PiiEntityCategory(BRLegalEntityNumberValue); - /// BRNationalIDRG. + /// BR National ID RG. public static PiiEntityCategory BRNationalIdrg { get; } = new PiiEntityCategory(BRNationalIdrgValue); - /// BGUniformCivilNumber. + /// BG Uniform Civil Number. public static PiiEntityCategory BGUniformCivilNumber { get; } = new PiiEntityCategory(BGUniformCivilNumberValue); - /// CABankAccountNumber. + /// CA Bank Account Number. public static PiiEntityCategory CABankAccountNumber { get; } = new PiiEntityCategory(CABankAccountNumberValue); - /// CADriversLicenseNumber. + /// CA Driver's License Number. public static PiiEntityCategory CADriversLicenseNumber { get; } = new PiiEntityCategory(CADriversLicenseNumberValue); - /// CAHealthServiceNumber. + /// CA Health Service Number. public static PiiEntityCategory CAHealthServiceNumber { get; } = new PiiEntityCategory(CAHealthServiceNumberValue); - /// CAPassportNumber. + /// CA Passport Number. public static PiiEntityCategory CAPassportNumber { get; } = new PiiEntityCategory(CAPassportNumberValue); - /// CAPersonalHealthIdentification. + /// CA Personal Health Identification. public static PiiEntityCategory CAPersonalHealthIdentification { get; } = new PiiEntityCategory(CAPersonalHealthIdentificationValue); - /// CASocialInsuranceNumber. + /// CA Social Insurance Number. public static PiiEntityCategory CASocialInsuranceNumber { get; } = new PiiEntityCategory(CASocialInsuranceNumberValue); - /// CLIdentityCardNumber. + /// CL Identity Card Number. public static PiiEntityCategory CLIdentityCardNumber { get; } = new PiiEntityCategory(CLIdentityCardNumberValue); - /// CNResidentIdentityCardNumber. + /// CN Resident Identity Card Number. public static PiiEntityCategory CNResidentIdentityCardNumber { get; } = new PiiEntityCategory(CNResidentIdentityCardNumberValue); - /// CreditCardNumber. + /// Credit Card Number. public static PiiEntityCategory CreditCardNumber { get; } = new PiiEntityCategory(CreditCardNumberValue); - /// HRIdentityCardNumber. + /// HR Identity Card Number. public static PiiEntityCategory HRIdentityCardNumber { get; } = new PiiEntityCategory(HRIdentityCardNumberValue); - /// HRNationalIDNumber. + /// HR National ID Number. public static PiiEntityCategory HRNationalIDNumber { get; } = new PiiEntityCategory(HRNationalIDNumberValue); - /// HRPersonalIdentificationNumber. + /// HR Personal Identification Number. public static PiiEntityCategory HRPersonalIdentificationNumber { get; } = new PiiEntityCategory(HRPersonalIdentificationNumberValue); - /// HRPersonalIdentificationOIBNumberV2. + /// HR Personal Identification OIB Number V2. public static PiiEntityCategory HRPersonalIdentificationOIBNumberV2 { get; } = new PiiEntityCategory(HRPersonalIdentificationOIBNumberV2Value); - /// CYIdentityCard. + /// CY Identity Card. public static PiiEntityCategory CYIdentityCard { get; } = new PiiEntityCategory(CYIdentityCardValue); - /// CYTaxIdentificationNumber. + /// CY Tax Identification Number. public static PiiEntityCategory CYTaxIdentificationNumber { get; } = new PiiEntityCategory(CYTaxIdentificationNumberValue); - /// CZPersonalIdentityNumber. + /// CZ Personal Identity Number. public static PiiEntityCategory CZPersonalIdentityNumber { get; } = new PiiEntityCategory(CZPersonalIdentityNumberValue); - /// CZPersonalIdentityV2. + /// CZ Personal Identity V2. public static PiiEntityCategory CZPersonalIdentityV2 { get; } = new PiiEntityCategory(CZPersonalIdentityV2Value); - /// DKPersonalIdentificationNumber. + /// DK Personal Identification Number. public static PiiEntityCategory DKPersonalIdentificationNumber { get; } = new PiiEntityCategory(DKPersonalIdentificationNumberValue); - /// DKPersonalIdentificationV2. + /// DK Personal Identification V2. public static PiiEntityCategory DKPersonalIdentificationV2 { get; } = new PiiEntityCategory(DKPersonalIdentificationV2Value); - /// DrugEnforcementAgencyNumber. + /// Drug Enforcement Agency Number. public static PiiEntityCategory DrugEnforcementAgencyNumber { get; } = new PiiEntityCategory(DrugEnforcementAgencyNumberValue); - /// EEPersonalIdentificationCode. + /// EE Personal Identification Code. public static PiiEntityCategory EEPersonalIdentificationCode { get; } = new PiiEntityCategory(EEPersonalIdentificationCodeValue); - /// EUDebitCardNumber. + /// EU Debit Card Number. public static PiiEntityCategory EUDebitCardNumber { get; } = new PiiEntityCategory(EUDebitCardNumberValue); - /// EUDriversLicenseNumber. + /// EU Driver's License Number. public static PiiEntityCategory EUDriversLicenseNumber { get; } = new PiiEntityCategory(EUDriversLicenseNumberValue); - /// EUGPSCoordinates. + /// EU GPS Coordinates. public static PiiEntityCategory EugpsCoordinates { get; } = new PiiEntityCategory(EugpsCoordinatesValue); - /// EUNationalIdentificationNumber. + /// EU National Identification Number. public static PiiEntityCategory EUNationalIdentificationNumber { get; } = new PiiEntityCategory(EUNationalIdentificationNumberValue); - /// EUPassportNumber. + /// EU Passport Number. public static PiiEntityCategory EUPassportNumber { get; } = new PiiEntityCategory(EUPassportNumberValue); - /// EUSocialSecurityNumber. + /// EU Social Security Number. public static PiiEntityCategory EUSocialSecurityNumber { get; } = new PiiEntityCategory(EUSocialSecurityNumberValue); - /// EUTaxIdentificationNumber. + /// EU Tax Identification Number. public static PiiEntityCategory EUTaxIdentificationNumber { get; } = new PiiEntityCategory(EUTaxIdentificationNumberValue); - /// FIEuropeanHealthNumber. + /// FI European Health Number. public static PiiEntityCategory FIEuropeanHealthNumber { get; } = new PiiEntityCategory(FIEuropeanHealthNumberValue); - /// FINationalID. + /// FI National ID. public static PiiEntityCategory FINationalID { get; } = new PiiEntityCategory(FINationalIDValue); - /// FINationalIDV2. + /// FI National ID V2. public static PiiEntityCategory FINationalIDV2 { get; } = new PiiEntityCategory(FINationalIDV2Value); - /// FIPassportNumber. + /// FI Passport Number. public static PiiEntityCategory FIPassportNumber { get; } = new PiiEntityCategory(FIPassportNumberValue); - /// FRDriversLicenseNumber. + /// FR Driver's License Number. public static PiiEntityCategory FRDriversLicenseNumber { get; } = new PiiEntityCategory(FRDriversLicenseNumberValue); - /// FRHealthInsuranceNumber. + /// FR Health Insurance Number. public static PiiEntityCategory FRHealthInsuranceNumber { get; } = new PiiEntityCategory(FRHealthInsuranceNumberValue); - /// FRNationalID. + /// FR National ID. public static PiiEntityCategory FRNationalID { get; } = new PiiEntityCategory(FRNationalIDValue); - /// FRPassportNumber. + /// FR Passport Number. public static PiiEntityCategory FRPassportNumber { get; } = new PiiEntityCategory(FRPassportNumberValue); - /// FRSocialSecurityNumber. + /// FR Social Security Number. public static PiiEntityCategory FRSocialSecurityNumber { get; } = new PiiEntityCategory(FRSocialSecurityNumberValue); - /// FRTaxIdentificationNumber. + /// FR Tax Identification Number. public static PiiEntityCategory FRTaxIdentificationNumber { get; } = new PiiEntityCategory(FRTaxIdentificationNumberValue); - /// FRValueAddedTaxNumber. + /// FR Value Added Tax Number. public static PiiEntityCategory FRValueAddedTaxNumber { get; } = new PiiEntityCategory(FRValueAddedTaxNumberValue); - /// DEDriversLicenseNumber. + /// DE Driver's License Number. public static PiiEntityCategory DEDriversLicenseNumber { get; } = new PiiEntityCategory(DEDriversLicenseNumberValue); - /// DEPassportNumber. + /// DE Passport Number. public static PiiEntityCategory DEPassportNumber { get; } = new PiiEntityCategory(DEPassportNumberValue); - /// DEIdentityCardNumber. + /// DE Identity Card Number. public static PiiEntityCategory DEIdentityCardNumber { get; } = new PiiEntityCategory(DEIdentityCardNumberValue); - /// DETaxIdentificationNumber. + /// DE Tax Identification Number. public static PiiEntityCategory DETaxIdentificationNumber { get; } = new PiiEntityCategory(DETaxIdentificationNumberValue); - /// DEValueAddedNumber. + /// DE Value Added Number. public static PiiEntityCategory DEValueAddedNumber { get; } = new PiiEntityCategory(DEValueAddedNumberValue); - /// GRNationalIDCard. + /// GR National ID Card. public static PiiEntityCategory GRNationalIDCard { get; } = new PiiEntityCategory(GRNationalIDCardValue); - /// GRNationalIDV2. + /// GR National ID V2. public static PiiEntityCategory GRNationalIDV2 { get; } = new PiiEntityCategory(GRNationalIDV2Value); - /// GRTaxIdentificationNumber. + /// GR Tax Identification Number. public static PiiEntityCategory GRTaxIdentificationNumber { get; } = new PiiEntityCategory(GRTaxIdentificationNumberValue); - /// HKIdentityCardNumber. + /// HK Identity Card Number. public static PiiEntityCategory HKIdentityCardNumber { get; } = new PiiEntityCategory(HKIdentityCardNumberValue); - /// HUValueAddedNumber. + /// HU Value Added Number. public static PiiEntityCategory HUValueAddedNumber { get; } = new PiiEntityCategory(HUValueAddedNumberValue); - /// HUPersonalIdentificationNumber. + /// HU Personal Identification Number. public static PiiEntityCategory HUPersonalIdentificationNumber { get; } = new PiiEntityCategory(HUPersonalIdentificationNumberValue); - /// HUTaxIdentificationNumber. + /// HU Tax Identification Number. public static PiiEntityCategory HUTaxIdentificationNumber { get; } = new PiiEntityCategory(HUTaxIdentificationNumberValue); - /// INPermanentAccount. + /// IN Permanent Account. public static PiiEntityCategory INPermanentAccount { get; } = new PiiEntityCategory(INPermanentAccountValue); - /// INUniqueIdentificationNumber. + /// IN Unique Identification Number. public static PiiEntityCategory INUniqueIdentificationNumber { get; } = new PiiEntityCategory(INUniqueIdentificationNumberValue); - /// IDIdentityCardNumber. + /// ID Identity Card Number. public static PiiEntityCategory IDIdentityCardNumber { get; } = new PiiEntityCategory(IDIdentityCardNumberValue); - /// InternationalBankingAccountNumber. + /// International Banking Account Number. public static PiiEntityCategory InternationalBankingAccountNumber { get; } = new PiiEntityCategory(InternationalBankingAccountNumberValue); - /// IEPersonalPublicServiceNumber. + /// IE Personal Public Service Number. public static PiiEntityCategory IEPersonalPublicServiceNumber { get; } = new PiiEntityCategory(IEPersonalPublicServiceNumberValue); - /// IEPersonalPublicServiceNumberV2. + /// IE Personal Public Service Number V2. public static PiiEntityCategory IEPersonalPublicServiceNumberV2 { get; } = new PiiEntityCategory(IEPersonalPublicServiceNumberV2Value); - /// ILBankAccountNumber. + /// IL Bank Account Number. public static PiiEntityCategory ILBankAccountNumber { get; } = new PiiEntityCategory(ILBankAccountNumberValue); - /// ILNationalID. + /// IL National ID. public static PiiEntityCategory ILNationalID { get; } = new PiiEntityCategory(ILNationalIDValue); - /// ITDriversLicenseNumber. + /// IT Driver's License Number. public static PiiEntityCategory ITDriversLicenseNumber { get; } = new PiiEntityCategory(ITDriversLicenseNumberValue); - /// ITFiscalCode. + /// IT Fiscal Code. public static PiiEntityCategory ITFiscalCode { get; } = new PiiEntityCategory(ITFiscalCodeValue); - /// ITValueAddedTaxNumber. + /// IT Value Added Tax Number. public static PiiEntityCategory ITValueAddedTaxNumber { get; } = new PiiEntityCategory(ITValueAddedTaxNumberValue); - /// JPBankAccountNumber. + /// JP Bank Account Number. public static PiiEntityCategory JPBankAccountNumber { get; } = new PiiEntityCategory(JPBankAccountNumberValue); - /// JPDriversLicenseNumber. + /// JP Driver's License Number. public static PiiEntityCategory JPDriversLicenseNumber { get; } = new PiiEntityCategory(JPDriversLicenseNumberValue); - /// JPPassportNumber. + /// JP Passport Number. public static PiiEntityCategory JPPassportNumber { get; } = new PiiEntityCategory(JPPassportNumberValue); - /// JPResidentRegistrationNumber. + /// JP Resident Registration Number. public static PiiEntityCategory JPResidentRegistrationNumber { get; } = new PiiEntityCategory(JPResidentRegistrationNumberValue); - /// JPSocialInsuranceNumber. + /// JP Social Insurance Number. public static PiiEntityCategory JPSocialInsuranceNumber { get; } = new PiiEntityCategory(JPSocialInsuranceNumberValue); - /// JPMyNumberCorporate. + /// JP My Number Corporate. public static PiiEntityCategory JPMyNumberCorporate { get; } = new PiiEntityCategory(JPMyNumberCorporateValue); - /// JPMyNumberPersonal. + /// JP My Number Personal. public static PiiEntityCategory JPMyNumberPersonal { get; } = new PiiEntityCategory(JPMyNumberPersonalValue); - /// JPResidenceCardNumber. + /// JP Residence Card Number. public static PiiEntityCategory JPResidenceCardNumber { get; } = new PiiEntityCategory(JPResidenceCardNumberValue); - /// LVPersonalCode. + /// LV Personal Code. public static PiiEntityCategory LVPersonalCode { get; } = new PiiEntityCategory(LVPersonalCodeValue); - /// LTPersonalCode. + /// LT Personal Code. public static PiiEntityCategory LTPersonalCode { get; } = new PiiEntityCategory(LTPersonalCodeValue); - /// LUNationalIdentificationNumberNatural. + /// LU National Identification Number Natural. public static PiiEntityCategory LUNationalIdentificationNumberNatural { get; } = new PiiEntityCategory(LUNationalIdentificationNumberNaturalValue); - /// LUNationalIdentificationNumberNonNatural. + /// LU National Identification Number Non Natural. public static PiiEntityCategory LUNationalIdentificationNumberNonNatural { get; } = new PiiEntityCategory(LUNationalIdentificationNumberNonNaturalValue); - /// MYIdentityCardNumber. + /// MY Identity Card Number. public static PiiEntityCategory MYIdentityCardNumber { get; } = new PiiEntityCategory(MYIdentityCardNumberValue); - /// MTIdentityCardNumber. + /// MT Identity Card Number. public static PiiEntityCategory MTIdentityCardNumber { get; } = new PiiEntityCategory(MTIdentityCardNumberValue); - /// MTTaxIDNumber. + /// MT Tax ID Number. public static PiiEntityCategory MTTaxIDNumber { get; } = new PiiEntityCategory(MTTaxIDNumberValue); - /// NLCitizensServiceNumber. + /// NL Citizens Service Number. public static PiiEntityCategory NLCitizensServiceNumber { get; } = new PiiEntityCategory(NLCitizensServiceNumberValue); - /// NLCitizensServiceNumberV2. + /// NL Citizens Service Number V2. public static PiiEntityCategory NLCitizensServiceNumberV2 { get; } = new PiiEntityCategory(NLCitizensServiceNumberV2Value); - /// NLTaxIdentificationNumber. + /// NL Tax Identification Number. public static PiiEntityCategory NLTaxIdentificationNumber { get; } = new PiiEntityCategory(NLTaxIdentificationNumberValue); - /// NLValueAddedTaxNumber. + /// NL Value Added Tax Number. public static PiiEntityCategory NLValueAddedTaxNumber { get; } = new PiiEntityCategory(NLValueAddedTaxNumberValue); - /// NZBankAccountNumber. + /// NZ Bank Account Number. public static PiiEntityCategory NZBankAccountNumber { get; } = new PiiEntityCategory(NZBankAccountNumberValue); - /// NZDriversLicenseNumber. + /// NZ Driver's License Number. public static PiiEntityCategory NZDriversLicenseNumber { get; } = new PiiEntityCategory(NZDriversLicenseNumberValue); - /// NZInlandRevenueNumber. + /// NZ Inland Revenue Number. public static PiiEntityCategory NZInlandRevenueNumber { get; } = new PiiEntityCategory(NZInlandRevenueNumberValue); - /// NZMinistryOfHealthNumber. + /// NZ Ministry Of Health Number. public static PiiEntityCategory NZMinistryOfHealthNumber { get; } = new PiiEntityCategory(NZMinistryOfHealthNumberValue); - /// NZSocialWelfareNumber. + /// NZ Social Welfare Number. public static PiiEntityCategory NZSocialWelfareNumber { get; } = new PiiEntityCategory(NZSocialWelfareNumberValue); - /// NOIdentityNumber. + /// NO Identity Number. public static PiiEntityCategory NOIdentityNumber { get; } = new PiiEntityCategory(NOIdentityNumberValue); - /// PHUnifiedMultiPurposeIDNumber. + /// PH Unified Multi Purpose ID Number. public static PiiEntityCategory PHUnifiedMultiPurposeIDNumber { get; } = new PiiEntityCategory(PHUnifiedMultiPurposeIDNumberValue); - /// PLIdentityCard. + /// PL Identity Card. public static PiiEntityCategory PLIdentityCard { get; } = new PiiEntityCategory(PLIdentityCardValue); - /// PLNationalID. + /// PL National ID. public static PiiEntityCategory PLNationalID { get; } = new PiiEntityCategory(PLNationalIDValue); - /// PLNationalIDV2. + /// PL National ID V2. public static PiiEntityCategory PLNationalIDV2 { get; } = new PiiEntityCategory(PLNationalIDV2Value); - /// PLPassportNumber. + /// PL Passport Number. public static PiiEntityCategory PLPassportNumber { get; } = new PiiEntityCategory(PLPassportNumberValue); - /// PLTaxIdentificationNumber. + /// PL Tax Identification Number. public static PiiEntityCategory PLTaxIdentificationNumber { get; } = new PiiEntityCategory(PLTaxIdentificationNumberValue); - /// PLREGONNumber. + /// PL REGON Number. public static PiiEntityCategory PlregonNumber { get; } = new PiiEntityCategory(PlregonNumberValue); - /// PTCitizenCardNumber. + /// PT Citizen Card Number. public static PiiEntityCategory PTCitizenCardNumber { get; } = new PiiEntityCategory(PTCitizenCardNumberValue); - /// PTCitizenCardNumberV2. + /// PT Citizen Card Number V2. public static PiiEntityCategory PTCitizenCardNumberV2 { get; } = new PiiEntityCategory(PTCitizenCardNumberV2Value); - /// PTTaxIdentificationNumber. + /// PT Tax Identification Number. public static PiiEntityCategory PTTaxIdentificationNumber { get; } = new PiiEntityCategory(PTTaxIdentificationNumberValue); - /// ROPersonalNumericalCode. + /// RO Personal Numerical Code. public static PiiEntityCategory ROPersonalNumericalCode { get; } = new PiiEntityCategory(ROPersonalNumericalCodeValue); - /// RUPassportNumberDomestic. + /// RU Passport Number Domestic. public static PiiEntityCategory RUPassportNumberDomestic { get; } = new PiiEntityCategory(RUPassportNumberDomesticValue); - /// RUPassportNumberInternational. + /// RU Passport Number International. public static PiiEntityCategory RUPassportNumberInternational { get; } = new PiiEntityCategory(RUPassportNumberInternationalValue); - /// SANationalID. + /// SA National ID. public static PiiEntityCategory SANationalID { get; } = new PiiEntityCategory(SANationalIDValue); - /// SGNationalRegistrationIdentityCardNumber. + /// SG National Registration Identity Card Number. public static PiiEntityCategory SGNationalRegistrationIdentityCardNumber { get; } = new PiiEntityCategory(SGNationalRegistrationIdentityCardNumberValue); - /// SKPersonalNumber. + /// SK Personal Number. public static PiiEntityCategory SKPersonalNumber { get; } = new PiiEntityCategory(SKPersonalNumberValue); - /// SITaxIdentificationNumber. + /// SI Tax Identification Number. public static PiiEntityCategory SITaxIdentificationNumber { get; } = new PiiEntityCategory(SITaxIdentificationNumberValue); - /// SIUniqueMasterCitizenNumber. + /// SI Unique Master Citizen Number. public static PiiEntityCategory SIUniqueMasterCitizenNumber { get; } = new PiiEntityCategory(SIUniqueMasterCitizenNumberValue); - /// ZAIdentificationNumber. + /// ZA Identification Number. public static PiiEntityCategory ZAIdentificationNumber { get; } = new PiiEntityCategory(ZAIdentificationNumberValue); - /// KRResidentRegistrationNumber. + /// KR Resident Registration Number. public static PiiEntityCategory KRResidentRegistrationNumber { get; } = new PiiEntityCategory(KRResidentRegistrationNumberValue); - /// ESDNI. + /// ES DNI. public static PiiEntityCategory Esdni { get; } = new PiiEntityCategory(EsdniValue); - /// ESSocialSecurityNumber. + /// ES Social Security Number. public static PiiEntityCategory ESSocialSecurityNumber { get; } = new PiiEntityCategory(ESSocialSecurityNumberValue); - /// ESTaxIdentificationNumber. + /// ES Tax Identification Number. public static PiiEntityCategory ESTaxIdentificationNumber { get; } = new PiiEntityCategory(ESTaxIdentificationNumberValue); - /// SQLServerConnectionString. + /// SQL Server Connection String. public static PiiEntityCategory SQLServerConnectionString { get; } = new PiiEntityCategory(SQLServerConnectionStringValue); - /// SENationalID. + /// SE National ID. public static PiiEntityCategory SENationalID { get; } = new PiiEntityCategory(SENationalIDValue); - /// SENationalIDV2. + /// SE National ID V2. public static PiiEntityCategory SENationalIDV2 { get; } = new PiiEntityCategory(SENationalIDV2Value); - /// SEPassportNumber. + /// SE Passport Number. public static PiiEntityCategory SEPassportNumber { get; } = new PiiEntityCategory(SEPassportNumberValue); - /// SETaxIdentificationNumber. + /// SE Tax Identification Number. public static PiiEntityCategory SETaxIdentificationNumber { get; } = new PiiEntityCategory(SETaxIdentificationNumberValue); - /// SWIFTCode. + /// SWIFT Code. public static PiiEntityCategory SwiftCode { get; } = new PiiEntityCategory(SwiftCodeValue); - /// CHSocialSecurityNumber. + /// CH Social Security Number. public static PiiEntityCategory CHSocialSecurityNumber { get; } = new PiiEntityCategory(CHSocialSecurityNumberValue); - /// TWNationalID. + /// TW National ID. public static PiiEntityCategory TWNationalID { get; } = new PiiEntityCategory(TWNationalIDValue); - /// TWPassportNumber. + /// TW Passport Number. public static PiiEntityCategory TWPassportNumber { get; } = new PiiEntityCategory(TWPassportNumberValue); - /// TWResidentCertificate. + /// TW Resident Certificate. public static PiiEntityCategory TWResidentCertificate { get; } = new PiiEntityCategory(TWResidentCertificateValue); - /// THPopulationIdentificationCode. + /// TH Population Identification Code. public static PiiEntityCategory THPopulationIdentificationCode { get; } = new PiiEntityCategory(THPopulationIdentificationCodeValue); - /// TRNationalIdentificationNumber. + /// TR National Identification Number. public static PiiEntityCategory TRNationalIdentificationNumber { get; } = new PiiEntityCategory(TRNationalIdentificationNumberValue); - /// UKDriversLicenseNumber. + /// UK Driver's License Number. public static PiiEntityCategory UKDriversLicenseNumber { get; } = new PiiEntityCategory(UKDriversLicenseNumberValue); - /// UKElectoralRollNumber. + /// UK Electoral Roll Number. public static PiiEntityCategory UKElectoralRollNumber { get; } = new PiiEntityCategory(UKElectoralRollNumberValue); - /// UKNationalHealthNumber. + /// UK National Health Number. public static PiiEntityCategory UKNationalHealthNumber { get; } = new PiiEntityCategory(UKNationalHealthNumberValue); - /// UKNationalInsuranceNumber. + /// UK National Insurance Number. public static PiiEntityCategory UKNationalInsuranceNumber { get; } = new PiiEntityCategory(UKNationalInsuranceNumberValue); - /// UKUniqueTaxpayerNumber. + /// UK Unique Taxpayer Number. public static PiiEntityCategory UKUniqueTaxpayerNumber { get; } = new PiiEntityCategory(UKUniqueTaxpayerNumberValue); - /// USUKPassportNumber. + /// US UK Passport Number. public static PiiEntityCategory UsukPassportNumber { get; } = new PiiEntityCategory(UsukPassportNumberValue); - /// USBankAccountNumber. + /// US Bank Account Number. public static PiiEntityCategory USBankAccountNumber { get; } = new PiiEntityCategory(USBankAccountNumberValue); - /// USDriversLicenseNumber. + /// US Driver's License Number. public static PiiEntityCategory USDriversLicenseNumber { get; } = new PiiEntityCategory(USDriversLicenseNumberValue); - /// USIndividualTaxpayerIdentification. + /// US Individual Taxpayer Identification. public static PiiEntityCategory USIndividualTaxpayerIdentification { get; } = new PiiEntityCategory(USIndividualTaxpayerIdentificationValue); - /// USSocialSecurityNumber. + /// US Social Security Number. public static PiiEntityCategory USSocialSecurityNumber { get; } = new PiiEntityCategory(USSocialSecurityNumberValue); - /// UAPassportNumberDomestic. + /// UA Passport Number Domestic. public static PiiEntityCategory UAPassportNumberDomestic { get; } = new PiiEntityCategory(UAPassportNumberDomesticValue); - /// UAPassportNumberInternational. + /// UA Passport Number International. public static PiiEntityCategory UAPassportNumberInternational { get; } = new PiiEntityCategory(UAPassportNumberInternationalValue); /// Organization. public static PiiEntityCategory Organization { get; } = new PiiEntityCategory(OrganizationValue); @@ -528,9 +528,9 @@ public PiiEntityCategory(string value) public static PiiEntityCategory URL { get; } = new PiiEntityCategory(URLValue); /// Age. public static PiiEntityCategory Age { get; } = new PiiEntityCategory(AgeValue); - /// PhoneNumber. + /// Phone Number. public static PiiEntityCategory PhoneNumber { get; } = new PiiEntityCategory(PhoneNumberValue); - /// IPAddress. + /// IP Address. public static PiiEntityCategory IPAddress { get; } = new PiiEntityCategory(IPAddressValue); /// Date. public static PiiEntityCategory Date { get; } = new PiiEntityCategory(DateValue); @@ -538,9 +538,9 @@ public PiiEntityCategory(string value) public static PiiEntityCategory Person { get; } = new PiiEntityCategory(PersonValue); /// Address. public static PiiEntityCategory Address { get; } = new PiiEntityCategory(AddressValue); - /// All. + /// All PII categories. public static PiiEntityCategory All { get; } = new PiiEntityCategory(AllValue); - /// Default. + /// Default PII categories for the language. public static PiiEntityCategory Default { get; } = new PiiEntityCategory(DefaultValue); /// Determines if two values are the same. public static bool operator ==(PiiEntityCategory left, PiiEntityCategory right) => left.Equals(right); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.Serialization.cs index 30b4acd4783d..728f963e02f2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class PiiEntityRecognitionLROResult : IUtf8JsonSerializable + internal partial class PiiEntityRecognitionLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static PiiEntityRecognitionLROResult DeserializePiiEntityRecognitionLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static PiiEntityRecognitionLROResult DeserializePiiEntityRecognitionLRO return null; } PiiEntitiesResult results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static PiiEntityRecognitionLROResult DeserializePiiEntityRecognitionLRO results = PiiEntitiesResult.DeserializePiiEntitiesResult(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new PiiEntityRecognitionLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new PiiEntityRecognitionLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static PiiEntityRecognitionLROResult DeserializePiiEntityRecognitionLRO using var document = JsonDocument.Parse(response.Content); return DeserializePiiEntityRecognitionLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.cs index 4ac52d7a7574..eae8fecc5d4b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiEntityRecognitionLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The PiiEntityRecognitionLROResult. + /// Contains the PII LRO results. internal partial class PiiEntityRecognitionLROResult : AnalyzeTextLROResult { /// 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. - public PiiEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, PiiEntitiesResult results) : base(lastUpdateDateTime, status) + internal PiiEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, PiiEntitiesResult results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public PiiEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnal } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal PiiEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, PiiEntitiesResult results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// The list of pii results. + internal PiiEntityRecognitionLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, PiiEntitiesResult results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public PiiEntitiesResult Results { get; set; } + /// The list of pii results. + public PiiEntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.Serialization.cs index 3b983c83e6f1..5e3e2c61bdc6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static PiiLROTask DeserializePiiLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - PiiTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = PiiTaskParameters.DeserializePiiTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new PiiLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new PiiLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePiiLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.cs index 63641ab154b7..babe90ff642a 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiLROTask.cs @@ -7,7 +7,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// An object representing the task definition for a PII Entities Recognition task. + /// Contains the analyze text PIIEntityRecognition LRO task. internal partial class PiiLROTask : AnalyzeTextLROTask { /// Initializes a new instance of . @@ -17,16 +17,16 @@ public PiiLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a PII Entities Recognition task. + /// task name. + /// The kind of task to perform. + /// Pii task parameters. internal PiiLROTask(string taskName, AnalyzeTextLROTaskKind kind, PiiTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a PII Entities Recognition task. + /// Pii task parameters. public PiiTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.Serialization.cs deleted file mode 100644 index 9476d66dff70..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.Serialization.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class PiiResultDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("redactedText"u8); - writer.WriteStringValue(RedactedText); - writer.WritePropertyName("entities"u8); - writer.WriteStartArray(); - foreach (var item in Entities) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static PiiResultDocumentsItem DeserializePiiResultDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string redactedText = default; - IList entities = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - 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(Entity.DeserializeEntity(item)); - } - entities = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new PiiResultDocumentsItem(id, warnings, statistics, redactedText, entities); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new PiiResultDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePiiResultDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.cs deleted file mode 100644 index 8b2c631c22e5..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The PiiResultDocumentsItem. - internal partial class PiiResultDocumentsItem : PiiEntitiesDocumentResult - { - /// 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. - public PiiResultDocumentsItem(string id, IEnumerable warnings, string redactedText, IEnumerable entities) : base(id, warnings, redactedText, entities) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(redactedText, nameof(redactedText)); - Argument.AssertNotNull(entities, nameof(entities)); - } - - /// 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. - internal PiiResultDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, string redactedText, IList entities) : base(id, warnings, statistics, redactedText, entities) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.Serialization.cs index 6aba4a44c028..8aee46becce1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.Serialization.cs @@ -5,7 +5,6 @@ #nullable disable -using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -16,6 +15,16 @@ internal partial class PiiTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + 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); @@ -36,92 +45,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("stringIndexType"u8); writer.WriteStringValue(StringIndexType.Value.ToString()); } - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } - if (Optional.IsDefined(LoggingOptOut)) - { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); - } writer.WriteEndObject(); } - internal static PiiTaskParameters DeserializePiiTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - PiiDomain? domain = default; - IList piiCategories = default; - StringIndexType? stringIndexType = default; - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - 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 PiiEntityCategory(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("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new PiiTaskParameters(loggingOptOut, modelVersion, domain, piiCategories ?? new ChangeTrackingList(), stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new PiiTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePiiTaskParameters(document.RootElement); - } - /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.cs index 325ba1d66c47..757d486ccc5e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a PII Entities Recognition task. - internal partial class PiiTaskParameters : PreBuiltTaskParameters + internal partial class PiiTaskParameters { /// Initializes a new instance of . public PiiTaskParameters() @@ -19,21 +19,27 @@ public PiiTaskParameters() } /// Initializes a new instance of . - /// - /// - /// The PII domain used for PII Entity Recognition. - /// (Optional) describes the PII categories to return. - /// 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. - internal PiiTaskParameters(bool? loggingOptOut, string modelVersion, PiiDomain? domain, IList piiCategories, StringIndexType? stringIndexType) : base(loggingOptOut, modelVersion) + /// 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. + internal PiiTaskParameters(bool? loggingOptOut, string modelVersion, PiiDomain? domain, IList piiCategories, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; Domain = domain; PiiCategories = piiCategories; StringIndexType = stringIndexType; } - /// The PII domain used for PII Entity Recognition. + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Domain for PII task. public PiiDomain? Domain { get; set; } - /// 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. + /// StringIndexType to be used for analysis. public StringIndexType? StringIndexType { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskResult.cs index 71c5c8988e98..aff5c9bb87d4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiTaskResult.cs @@ -9,11 +9,11 @@ namespace Azure.AI.TextAnalytics.Models { - /// The PiiTaskResult. + /// Contains the analyze text PIIEntityRecognition LRO task. internal partial class PiiTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// + /// The list of pii results. /// is null. internal PiiTaskResult(PiiEntitiesResult results) { @@ -24,15 +24,15 @@ internal PiiTaskResult(PiiEntitiesResult results) } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. - /// + /// The kind of task result. + /// The list of pii results. internal PiiTaskResult(AnalyzeTextTaskResultsKind kind, PiiEntitiesResult results) : base(kind) { Results = results; Kind = kind; } - /// Gets the results. + /// The list of pii results. public PiiEntitiesResult Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.Serialization.cs deleted file mode 100644 index c8c75f63edf3..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.Serialization.cs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class PreBuiltResult : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - - internal static PreBuiltResult DeserializePreBuiltResult(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList errors = default; - TextDocumentBatchStatistics statistics = default; - string modelVersion = default; - 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)); - } - errors = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentBatchStatistics.DeserializeTextDocumentBatchStatistics(property.Value); - continue; - } - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - } - return new PreBuiltResult(errors, statistics, modelVersion); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static PreBuiltResult FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePreBuiltResult(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.cs deleted file mode 100644 index cfd4c1ba808f..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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.TextAnalytics.Models -{ - /// The PreBuiltResult. - internal partial class PreBuiltResult - { - /// Initializes a new instance of . - /// Errors by document id. - /// This field indicates which model is used for scoring. - /// or is null. - public PreBuiltResult(IEnumerable errors, string modelVersion) - { - Argument.AssertNotNull(errors, nameof(errors)); - Argument.AssertNotNull(modelVersion, nameof(modelVersion)); - - Errors = errors.ToList(); - ModelVersion = modelVersion; - } - - /// 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. - internal PreBuiltResult(IList errors, TextDocumentBatchStatistics statistics, string modelVersion) - { - Errors = errors; - Statistics = statistics; - ModelVersion = modelVersion; - } - - /// Errors by document id. - public IList Errors { get; } - /// if showStats=true was specified in the request this field will contain information about the request payload. - public TextDocumentBatchStatistics Statistics { get; set; } - /// This field indicates which model is used for scoring. - public string ModelVersion { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.Serialization.cs deleted file mode 100644 index 11813a8a4536..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.Serialization.cs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class PreBuiltTaskParameters : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ModelVersion)) - { - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - } - if (Optional.IsDefined(LoggingOptOut)) - { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); - } - writer.WriteEndObject(); - } - - internal static PreBuiltTaskParameters DeserializePreBuiltTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new PreBuiltTaskParameters(loggingOptOut, modelVersion); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new PreBuiltTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializePreBuiltTaskParameters(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.cs deleted file mode 100644 index e119c77bd0bf..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// Parameters object for a text analysis task using pre-built models. - internal partial class PreBuiltTaskParameters : TaskParameters - { - /// Initializes a new instance of . - public PreBuiltTaskParameters() - { - } - - /// Initializes a new instance of . - /// - /// - internal PreBuiltTaskParameters(bool? loggingOptOut, string modelVersion) : base(loggingOptOut) - { - ModelVersion = modelVersion; - } - - /// Gets or sets the model version. - public string ModelVersion { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.Serialization.cs index 8276d74414b6..fed47d77ef22 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.Serialization.cs @@ -6,30 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class SentenceAssessment : IUtf8JsonSerializable + internal partial class SentenceAssessment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("sentiment"u8); - writer.WriteStringValue(Sentiment); - writer.WritePropertyName("confidenceScores"u8); - writer.WriteObjectValue(ConfidenceScores); - 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); - writer.WriteEndObject(); - } - internal static SentenceAssessment DeserializeSentenceAssessment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -91,13 +72,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.cs index 25db6ebf0fe3..f206ce23a158 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceAssessment.cs @@ -9,18 +9,18 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentenceAssessment. + /// Represents a sentence assessment and the assessments or target objects related to it. internal partial class SentenceAssessment { /// Initializes a new instance of . - /// Assessment sentiment in the sentence. - /// Assessment sentiment confidence scores in the sentence. - /// The assessment offset from the start of the sentence. - /// The length of the assessment. - /// The assessment text detected. + /// 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. - public SentenceAssessment(string sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, bool isNegated) + internal SentenceAssessment(string sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, bool isNegated) { Argument.AssertNotNull(sentiment, nameof(sentiment)); Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); @@ -33,15 +33,15 @@ public SentenceAssessment(string sentiment, TargetConfidenceScoreLabel confidenc Text = text; IsNegated = isNegated; } - /// Assessment sentiment confidence scores in the sentence. - public TargetConfidenceScoreLabel ConfidenceScores { get; set; } - /// The assessment offset from the start of the sentence. - public int Offset { get; set; } - /// The length of the assessment. - public int Length { get; set; } - /// The assessment text detected. - public string Text { get; set; } + /// 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; set; } + public bool IsNegated { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.Serialization.cs index 5e1d5d4c7a87..9e1860075e6b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.Serialization.cs @@ -7,48 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial struct SentenceSentimentInternal : IUtf8JsonSerializable + internal partial struct SentenceSentimentInternal { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("text"u8); - writer.WriteStringValue(Text); - writer.WritePropertyName("sentiment"u8); - writer.WriteStringValue(Sentiment); - writer.WritePropertyName("confidenceScores"u8); - writer.WriteObjectValue(ConfidenceScores); - 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); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(Assessments)) - { - writer.WritePropertyName("assessments"u8); - writer.WriteStartArray(); - foreach (var item in Assessments) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - internal static SentenceSentimentInternal DeserializeSentenceSentimentInternal(JsonElement element) { string text = default; @@ -131,13 +94,5 @@ internal static SentenceSentimentInternal FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeSentenceSentimentInternal(document.RootElement); } - - /// Convert into a . - internal RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.cs index 737eb6bdb740..2565ea04a8df 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceSentimentInternal.cs @@ -11,19 +11,19 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentenceSentiment. + /// A document's sentence sentiment. internal readonly partial struct SentenceSentimentInternal { /// 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 sentence offset from the start of the document. - /// The length of the sentence. + /// 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. /// , or is null. - public SentenceSentimentInternal(string text, string sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IEnumerable targets, IEnumerable assessments) + internal SentenceSentimentInternal(string text, string sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IEnumerable targets, IEnumerable assessments) { Argument.AssertNotNull(text, nameof(text)); Argument.AssertNotNull(sentiment, nameof(sentiment)); @@ -42,8 +42,8 @@ public SentenceSentimentInternal(string text, string sentiment, SentimentConfide /// The sentence text. /// The predicted Sentiment for the sentence. /// The sentiment confidence score between 0 and 1 for the sentence for all classes. - /// The sentence offset from the start of the document. - /// The length of the sentence. + /// 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. internal SentenceSentimentInternal(string text, string sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IReadOnlyList targets, IReadOnlyList assessments) diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.Serialization.cs index b75fcfe947ce..c944f1118759 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.Serialization.cs @@ -7,35 +7,11 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class SentenceTarget : IUtf8JsonSerializable + internal partial class SentenceTarget { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("sentiment"u8); - writer.WriteStringValue(Sentiment); - writer.WritePropertyName("confidenceScores"u8); - writer.WriteObjectValue(ConfidenceScores); - 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); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static SentenceTarget DeserializeSentenceTarget(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -47,7 +23,7 @@ internal static SentenceTarget DeserializeSentenceTarget(JsonElement element) int offset = default; int length = default; string text = default; - IList relations = default; + IReadOnlyList relations = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sentiment"u8)) @@ -102,13 +78,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.cs index 73252692663b..e5de45e4f122 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentenceTarget.cs @@ -11,18 +11,18 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentenceTarget. + /// Represents a sentence target and the assessments or target objects related to it. internal partial class SentenceTarget { /// Initializes a new instance of . - /// Targeted sentiment in the sentence. - /// Target sentiment confidence scores for the target in the sentence. + /// 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. - public SentenceTarget(string sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IEnumerable relations) + internal SentenceTarget(string sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IEnumerable relations) { Argument.AssertNotNull(sentiment, nameof(sentiment)); Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); @@ -38,13 +38,13 @@ public SentenceTarget(string sentiment, TargetConfidenceScoreLabel confidenceSco } /// Initializes a new instance of . - /// Targeted sentiment in the sentence. - /// Target sentiment confidence scores for the target in the sentence. + /// 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. - internal SentenceTarget(string sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IList relations) + internal SentenceTarget(string sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IReadOnlyList relations) { Sentiment = sentiment; ConfidenceScores = confidenceScores; @@ -53,15 +53,15 @@ internal SentenceTarget(string sentiment, TargetConfidenceScoreLabel confidenceS Text = text; Relations = relations; } - /// Target sentiment confidence scores for the target in the sentence. - public TargetConfidenceScoreLabel ConfidenceScores { get; set; } + /// 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; set; } + public int Offset { get; } /// The length of the target. - public int Length { get; set; } + public int Length { get; } /// The target text detected. - public string Text { get; set; } + public string Text { get; } /// The array of either assessment or target objects which is related to the target. - public IList Relations { get; } + public IReadOnlyList Relations { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.Serialization.cs index 55fc1c4edbd9..3c850cde59a2 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.Serialization.cs @@ -20,58 +20,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("parameters"u8); writer.WriteObjectValue(Parameters); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); if (Optional.IsDefined(TaskName)) { writer.WritePropertyName("taskName"u8); writer.WriteStringValue(TaskName); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); writer.WriteEndObject(); } - internal static SentimentAnalysisLROTask DeserializeSentimentAnalysisLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - SentimentAnalysisTaskParameters parameters = default; - AnalyzeTextLROTaskKind kind = default; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("parameters"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - parameters = SentimentAnalysisTaskParameters.DeserializeSentimentAnalysisTaskParameters(property.Value); - continue; - } - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new SentimentAnalysisLROTask(taskName, kind, parameters); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new SentimentAnalysisLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSentimentAnalysisLROTask(document.RootElement); - } - /// Convert into a . internal override RequestContent ToRequestContent() { diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.cs index 355069753eab..ede5561b5f2d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisLROTask.cs @@ -17,16 +17,16 @@ public SentimentAnalysisLROTask() } /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - /// Supported parameters for a Sentiment Analysis task. + /// task name. + /// The kind of task to perform. + /// Parameters for the Sentiment Analysis task. internal SentimentAnalysisLROTask(string taskName, AnalyzeTextLROTaskKind kind, SentimentAnalysisTaskParameters parameters) : base(taskName, kind) { Parameters = parameters; Kind = kind; } - /// Supported parameters for a Sentiment Analysis task. + /// Parameters for the Sentiment Analysis task. public SentimentAnalysisTaskParameters Parameters { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.Serialization.cs index 213e6c31ae3c..5d35165c5857 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.Serialization.cs @@ -15,87 +15,31 @@ internal partial class SentimentAnalysisTaskParameters : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(OpinionMining)) - { - writer.WritePropertyName("opinionMining"u8); - writer.WriteBooleanValue(OpinionMining.Value); - } - if (Optional.IsDefined(StringIndexType)) + if (Optional.IsDefined(LoggingOptOut)) { - writer.WritePropertyName("stringIndexType"u8); - writer.WriteStringValue(StringIndexType.Value.ToString()); + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); } if (Optional.IsDefined(ModelVersion)) { writer.WritePropertyName("modelVersion"u8); writer.WriteStringValue(ModelVersion); } - if (Optional.IsDefined(LoggingOptOut)) - { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); - } - writer.WriteEndObject(); - } - - internal static SentimentAnalysisTaskParameters DeserializeSentimentAnalysisTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) + if (Optional.IsDefined(OpinionMining)) { - return null; + writer.WritePropertyName("opinionMining"u8); + writer.WriteBooleanValue(OpinionMining.Value); } - bool? opinionMining = default; - StringIndexType? stringIndexType = default; - string modelVersion = default; - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) + if (Optional.IsDefined(StringIndexType)) { - 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 (property.NameEquals("modelVersion"u8)) - { - modelVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); } - return new SentimentAnalysisTaskParameters(loggingOptOut, modelVersion, opinionMining, stringIndexType); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new SentimentAnalysisTaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSentimentAnalysisTaskParameters(document.RootElement); + writer.WriteEndObject(); } /// Convert into a . - internal override RequestContent ToRequestContent() + internal virtual RequestContent ToRequestContent() { var content = new Utf8JsonRequestContent(); content.JsonWriter.WriteObjectValue(this); diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.cs index 3396cd7fc1e6..ec67b9bc64bc 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentAnalysisTaskParameters.cs @@ -8,7 +8,7 @@ namespace Azure.AI.TextAnalytics.Models { /// Supported parameters for a Sentiment Analysis task. - internal partial class SentimentAnalysisTaskParameters : PreBuiltTaskParameters + internal partial class SentimentAnalysisTaskParameters { /// Initializes a new instance of . public SentimentAnalysisTaskParameters() @@ -16,19 +16,25 @@ public SentimentAnalysisTaskParameters() } /// Initializes a new instance of . - /// - /// - /// - /// 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. - internal SentimentAnalysisTaskParameters(bool? loggingOptOut, string modelVersion, bool? opinionMining, StringIndexType? stringIndexType) : base(loggingOptOut, modelVersion) + /// logging opt out. + /// model version. + /// Whether to use opinion mining in the request or not. + /// Specifies the method used to interpret string offsets. + internal SentimentAnalysisTaskParameters(bool? loggingOptOut, string modelVersion, bool? opinionMining, StringIndexType? stringIndexType) { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; OpinionMining = opinionMining; StringIndexType = stringIndexType; } - /// Gets or sets the opinion mining. + /// 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. Defaults to Text Elements (Graphemes) according to Unicode v8.0.0. For additional information see https://aka.ms/text-analytics-offsets. + /// Specifies the method used to interpret string offsets. public StringIndexType? StringIndexType { get; set; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.Serialization.cs index 70f8556d4def..6bf1bb64348b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.Serialization.cs @@ -6,24 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; -namespace Azure.AI.TextAnalytics +namespace Azure.AI.TextAnalytics.Models { - public partial class SentimentConfidenceScores : IUtf8JsonSerializable + internal partial class SentimentConfidenceScores { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("positive"u8); - writer.WriteNumberValue(Positive); - writer.WritePropertyName("neutral"u8); - writer.WriteNumberValue(Neutral); - writer.WritePropertyName("negative"u8); - writer.WriteNumberValue(Negative); - writer.WriteEndObject(); - } - internal static SentimentConfidenceScores DeserializeSentimentConfidenceScores(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -61,13 +48,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.cs index 7a819363e8a2..cf551aa54183 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentConfidenceScores.cs @@ -5,10 +5,27 @@ #nullable disable -namespace Azure.AI.TextAnalytics +namespace Azure.AI.TextAnalytics.Models { /// Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative. - public partial class SentimentConfidenceScores + internal partial class SentimentConfidenceScores { + /// 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; + } + + /// 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.TextAnalytics/src/Generated/Models/SentimentDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.Serialization.cs index d9c1ed683496..92306369dc74 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.Serialization.cs @@ -7,77 +7,25 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class SentimentDocumentResult : IUtf8JsonSerializable + internal partial class SentimentDocumentResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("sentiment"u8); - writer.WriteStringValue(Sentiment.ToSerialString()); - writer.WritePropertyName("confidenceScores"u8); - writer.WriteObjectValue(ConfidenceScores); - writer.WritePropertyName("sentences"u8); - writer.WriteStartArray(); - foreach (var item in Sentences) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - internal static SentimentDocumentResult DeserializeSentimentDocumentResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - TextSentiment sentiment = default; - SentimentConfidenceScores confidenceScores = default; - IList sentences = default; string id = default; - IList warnings = default; + IReadOnlyList warnings = default; TextDocumentStatistics? statistics = default; + TextSentiment sentiment = default; + SentimentConfidenceScores confidenceScores = default; + IReadOnlyList sentences = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sentiment"u8)) - { - sentiment = property.Value.GetString().ToTextSentiment(); - continue; - } - if (property.NameEquals("confidenceScores"u8)) - { - confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value); - continue; - } - if (property.NameEquals("sentences"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(SentenceSentimentInternal.DeserializeSentenceSentimentInternal(item)); - } - sentences = array; - continue; - } if (property.NameEquals("id"u8)) { id = property.Value.GetString(); @@ -102,6 +50,26 @@ internal static SentimentDocumentResult DeserializeSentimentDocumentResult(JsonE statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); continue; } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToTextSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceSentimentInternal.DeserializeSentenceSentimentInternal(item)); + } + sentences = array; + continue; + } } return new SentimentDocumentResult( id, @@ -114,18 +82,10 @@ internal static SentimentDocumentResult DeserializeSentimentDocumentResult(JsonE /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new SentimentDocumentResult FromResponse(Response response) + internal static SentimentDocumentResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeSentimentDocumentResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.cs index 5f023dbc6821..1e8d07f07281 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentDocumentResult.cs @@ -11,23 +11,25 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentimentDocumentResult. - internal partial class SentimentDocumentResult : DocumentResult + /// An object representing the pre-built Sentiment Analysis results of each document. + internal partial class SentimentDocumentResult { /// Initializes a new instance of . /// Unique, non-empty document identifier. /// Warnings encountered while processing document. /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). - /// Document level sentiment confidence scores between 0 and 1 for each sentiment class. - /// Sentence level sentiment analysis. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. /// , , or is null. - public SentimentDocumentResult(string id, IEnumerable warnings, TextSentiment sentiment, SentimentConfidenceScores confidenceScores, IEnumerable sentences) : base(id, warnings) + internal SentimentDocumentResult(string id, IEnumerable warnings, TextSentiment 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(); @@ -38,20 +40,29 @@ public SentimentDocumentResult(string id, IEnumerable warnings, /// 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). - /// Document level sentiment confidence scores between 0 and 1 for each sentiment class. - /// Sentence level sentiment analysis. - internal SentimentDocumentResult(string id, IList warnings, TextDocumentStatistics? statistics, TextSentiment sentiment, SentimentConfidenceScores confidenceScores, IList sentences) : base(id, warnings, statistics) + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + internal SentimentDocumentResult(string id, IReadOnlyList warnings, TextDocumentStatistics? statistics, TextSentiment sentiment, SentimentConfidenceScores confidenceScores, IReadOnlyList sentences) { + Id = id; + Warnings = warnings; + Statistics = statistics; Sentiment = sentiment; ConfidenceScores = confidenceScores; Sentences = sentences; } + /// 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 TextDocumentStatistics? Statistics { get; } /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). - public TextSentiment Sentiment { get; set; } - /// Document level sentiment confidence scores between 0 and 1 for each sentiment class. - public SentimentConfidenceScores ConfidenceScores { get; set; } - /// Sentence level sentiment analysis. - public IList Sentences { get; } + public TextSentiment 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; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.Serialization.cs index 9531872eea2f..5b370a5300b3 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.Serialization.cs @@ -7,31 +7,11 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class SentimentLROResult : IUtf8JsonSerializable + internal partial class SentimentLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("results"u8); - writer.WriteObjectValue(Results); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static SentimentLROResult DeserializeSentimentLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,10 +19,10 @@ internal static SentimentLROResult DeserializeSentimentLROResult(JsonElement ele return null; } SentimentResponse results = default; - AnalyzeTextLROResultsKind kind = default; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("results"u8)) @@ -50,28 +30,28 @@ internal static SentimentLROResult DeserializeSentimentLROResult(JsonElement ele results = SentimentResponse.DeserializeSentimentResponse(property.Value); continue; } - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new SentimentLROResult(lastUpdateDateTime, status, kind, taskName, results); + return new SentimentLROResult(lastUpdateDateTime, status, taskName, kind, results); } /// Deserializes the model from a raw response. @@ -81,13 +61,5 @@ internal static SentimentLROResult DeserializeSentimentLROResult(JsonElement ele using var document = JsonDocument.Parse(response.Content); return DeserializeSentimentLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.cs index 3074c6ef1bc1..cf8b295d17a5 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentLROResult.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentimentLROResult. + /// Contains the Sentiment Analysis LRO results. internal partial class SentimentLROResult : AnalyzeTextLROResult { /// 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. - public SentimentLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, SentimentResponse results) : base(lastUpdateDateTime, status) + internal SentimentLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, SentimentResponse results) : base(lastUpdateDateTime, status) { Argument.AssertNotNull(results, nameof(results)); @@ -26,18 +26,18 @@ public SentimentLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperat } /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - /// - internal SentimentLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName, SentimentResponse results) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + /// The sentiment analysis results. + internal SentimentLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind, SentimentResponse results) : base(lastUpdateDateTime, status, taskName, kind) { Results = results; Kind = kind; } - /// Gets or sets the results. - public SentimentResponse Results { get; set; } + /// The sentiment analysis results. + public SentimentResponse Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.Serialization.cs index 33effafc1492..4624223ede4d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.Serialization.cs @@ -7,61 +7,23 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class SentimentResponse : IUtf8JsonSerializable + internal partial class SentimentResponse { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documents"u8); - writer.WriteStartArray(); - foreach (var item in Documents) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("errors"u8); - writer.WriteStartArray(); - foreach (var item in Errors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WritePropertyName("modelVersion"u8); - writer.WriteStringValue(ModelVersion); - writer.WriteEndObject(); - } - internal static SentimentResponse DeserializeSentimentResponse(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList documents = default; - IList errors = default; + IReadOnlyList errors = default; TextDocumentBatchStatistics statistics = default; string modelVersion = default; + IReadOnlyList documents = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("documents"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(SentimentResponseDocumentsItem.DeserializeSentimentResponseDocumentsItem(item)); - } - documents = array; - continue; - } if (property.NameEquals("errors"u8)) { List array = new List(); @@ -86,24 +48,26 @@ internal static SentimentResponse DeserializeSentimentResponse(JsonElement eleme modelVersion = property.Value.GetString(); continue; } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentimentDocumentResult.DeserializeSentimentDocumentResult(item)); + } + documents = array; + continue; + } } return new SentimentResponse(errors, statistics, modelVersion, documents); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static new SentimentResponse FromResponse(Response response) + internal static SentimentResponse FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); return DeserializeSentimentResponse(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.cs index f17f6a25145a..6ac55985f2ea 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponse.cs @@ -11,20 +11,22 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentimentResponse. - internal partial class SentimentResponse : PreBuiltResult + /// Sentiment analysis results for the input documents. + internal partial class SentimentResponse { /// Initializes a new instance of . /// Errors by document id. /// This field indicates which model is used for scoring. - /// Sentiment analysis per document. + /// The sentiment analysis results for each document in the input. /// , or is null. - public SentimentResponse(IEnumerable errors, string modelVersion, IEnumerable documents) : base(errors, modelVersion) + internal SentimentResponse(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(); } @@ -32,13 +34,22 @@ public SentimentResponse(IEnumerable errors, string modelVersion, /// 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. - /// Sentiment analysis per document. - internal SentimentResponse(IList errors, TextDocumentBatchStatistics statistics, string modelVersion, IList documents) : base(errors, statistics, modelVersion) + /// The sentiment analysis results for each document in the input. + internal SentimentResponse(IReadOnlyList errors, TextDocumentBatchStatistics statistics, string modelVersion, IReadOnlyList documents) { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; Documents = documents; } - /// Sentiment analysis per document. - public IList 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 TextDocumentBatchStatistics 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.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.Serialization.cs deleted file mode 100644 index 431a7d6b618b..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.Serialization.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class SentimentResponseDocumentsItem : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("sentiment"u8); - writer.WriteStringValue(Sentiment.ToSerialString()); - writer.WritePropertyName("confidenceScores"u8); - writer.WriteObjectValue(ConfidenceScores); - writer.WritePropertyName("sentences"u8); - writer.WriteStartArray(); - foreach (var item in Sentences) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - writer.WritePropertyName("warnings"u8); - writer.WriteStartArray(); - foreach (var item in Warnings) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - if (Optional.IsDefined(Statistics)) - { - writer.WritePropertyName("statistics"u8); - writer.WriteObjectValue(Statistics); - } - writer.WriteEndObject(); - } - - internal static SentimentResponseDocumentsItem DeserializeSentimentResponseDocumentsItem(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - TextSentiment sentiment = default; - SentimentConfidenceScores confidenceScores = default; - IList sentences = default; - string id = default; - IList warnings = default; - TextDocumentStatistics? statistics = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sentiment"u8)) - { - sentiment = property.Value.GetString().ToTextSentiment(); - continue; - } - if (property.NameEquals("confidenceScores"u8)) - { - confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value); - continue; - } - if (property.NameEquals("sentences"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(SentenceSentimentInternal.DeserializeSentenceSentimentInternal(item)); - } - sentences = array; - continue; - } - 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)); - } - warnings = array; - continue; - } - if (property.NameEquals("statistics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - statistics = TextDocumentStatistics.DeserializeTextDocumentStatistics(property.Value); - continue; - } - } - return new SentimentResponseDocumentsItem( - id, - warnings, - statistics, - sentiment, - confidenceScores, - sentences); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new SentimentResponseDocumentsItem FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeSentimentResponseDocumentsItem(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.cs deleted file mode 100644 index 77c87ba5f70a..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The SentimentResponseDocumentsItem. - internal partial class SentimentResponseDocumentsItem : SentimentDocumentResult - { - /// Initializes a new instance of . - /// Unique, non-empty document identifier. - /// Warnings encountered while processing document. - /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). - /// Document level sentiment confidence scores between 0 and 1 for each sentiment class. - /// Sentence level sentiment analysis. - /// , , or is null. - public SentimentResponseDocumentsItem(string id, IEnumerable warnings, TextSentiment sentiment, SentimentConfidenceScores confidenceScores, IEnumerable sentences) : base(id, warnings, sentiment, confidenceScores, sentences) - { - Argument.AssertNotNull(id, nameof(id)); - Argument.AssertNotNull(warnings, nameof(warnings)); - Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); - Argument.AssertNotNull(sentences, nameof(sentences)); - } - - /// 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). - /// Document level sentiment confidence scores between 0 and 1 for each sentiment class. - /// Sentence level sentiment analysis. - internal SentimentResponseDocumentsItem(string id, IList warnings, TextDocumentStatistics? statistics, TextSentiment sentiment, SentimentConfidenceScores confidenceScores, IList sentences) : base(id, warnings, statistics, sentiment, confidenceScores, sentences) - { - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentTaskResult.cs index c79d8c04f9fe..b9f2fbba1032 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentTaskResult.cs @@ -9,11 +9,11 @@ namespace Azure.AI.TextAnalytics.Models { - /// The SentimentTaskResult. + /// Contains the analyze text SentimentAnalysis LRO task result. internal partial class SentimentTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// + /// The sentiment analysis results. /// is null. internal SentimentTaskResult(SentimentResponse results) { @@ -24,15 +24,15 @@ internal SentimentTaskResult(SentimentResponse results) } /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. - /// + /// The kind of task result. + /// The sentiment analysis results. internal SentimentTaskResult(AnalyzeTextTaskResultsKind kind, SentimentResponse results) : base(kind) { Results = results; Kind = kind; } - /// Gets the results. + /// The sentiment analysis results. public SentimentResponse Results { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/StringIndexType.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/StringIndexType.cs index 568833869e7e..1188ae7fb2d1 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/StringIndexType.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/StringIndexType.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics.Models { - /// 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. + /// String index type. internal readonly partial struct StringIndexType : IEquatable { private readonly string _value; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.Serialization.cs index bd46b71bfacc..cdbcede3cca4 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class SummaryContextInternal : IUtf8JsonSerializable + internal partial class SummaryContextInternal { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("offset"u8); - writer.WriteNumberValue(Offset); - writer.WritePropertyName("length"u8); - writer.WriteNumberValue(Length); - writer.WriteEndObject(); - } - internal static SummaryContextInternal DeserializeSummaryContextInternal(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,13 +42,5 @@ internal static SummaryContextInternal FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeSummaryContextInternal(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.cs index 488f7f8cdde5..e830a89b8e85 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SummaryContextInternal.cs @@ -13,15 +13,15 @@ internal partial class SummaryContextInternal /// 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. - public SummaryContextInternal(int offset, int length) + internal SummaryContextInternal(int offset, int length) { Offset = offset; Length = length; } /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. - public int Offset { get; set; } + public int Offset { get; } /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. - public int Length { get; set; } + public int Length { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs index c65f4729a64c..4b82ff9ffa0e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class TargetConfidenceScoreLabel : IUtf8JsonSerializable + internal partial class TargetConfidenceScoreLabel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("positive"u8); - writer.WriteNumberValue(Positive); - writer.WritePropertyName("negative"u8); - writer.WriteNumberValue(Negative); - writer.WriteEndObject(); - } - internal static TargetConfidenceScoreLabel DeserializeTargetConfidenceScoreLabel(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,13 +42,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.cs index a5fd885e39e7..16ffd92b8856 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetConfidenceScoreLabel.cs @@ -13,15 +13,15 @@ internal partial class TargetConfidenceScoreLabel /// Initializes a new instance of . /// Confidence score for positive sentiment. /// Confidence score for negative sentiment. - public TargetConfidenceScoreLabel(double positive, double negative) + internal TargetConfidenceScoreLabel(double positive, double negative) { Positive = positive; Negative = negative; } /// Confidence score for positive sentiment. - public double Positive { get; set; } + public double Positive { get; } /// Confidence score for negative sentiment. - public double Negative { get; set; } + public double Negative { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.Serialization.cs index f373d0a9d3ce..78bd26bf3f0e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.Serialization.cs @@ -6,44 +6,33 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class TargetRelation : IUtf8JsonSerializable + internal partial class TargetRelation { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("relationType"u8); - writer.WriteStringValue(RelationType.ToSerialString()); - writer.WritePropertyName("ref"u8); - writer.WriteStringValue(Ref); - writer.WriteEndObject(); - } - internal static TargetRelation DeserializeTargetRelation(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - TargetRelationType relationType = default; string @ref = default; + TargetRelationType relationType = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("relationType"u8)) + if (property.NameEquals("ref"u8)) { - relationType = property.Value.GetString().ToTargetRelationType(); + @ref = property.Value.GetString(); continue; } - if (property.NameEquals("ref"u8)) + if (property.NameEquals("relationType"u8)) { - @ref = property.Value.GetString(); + relationType = property.Value.GetString().ToTargetRelationType(); continue; } } - return new TargetRelation(relationType, @ref); + return new TargetRelation(@ref, relationType); } /// Deserializes the model from a raw response. @@ -53,13 +42,5 @@ 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); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.cs index a595cedd0ca0..7959443414ea 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TargetRelation.cs @@ -9,24 +9,24 @@ namespace Azure.AI.TextAnalytics.Models { - /// The TargetRelation. + /// Represents the relation between assessments and/or targets. internal partial class TargetRelation { /// Initializes a new instance of . - /// The type related to the target. /// The JSON pointer indicating the linked object. + /// The type related to the target. /// is null. - public TargetRelation(TargetRelationType relationType, string @ref) + internal TargetRelation(string @ref, TargetRelationType relationType) { Argument.AssertNotNull(@ref, nameof(@ref)); - RelationType = relationType; Ref = @ref; + RelationType = relationType; } - /// The type related to the target. - public TargetRelationType RelationType { get; set; } /// The JSON pointer indicating the linked object. - public string Ref { get; set; } + public string Ref { get; } + /// The type related to the target. + public TargetRelationType RelationType { get; } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.Serialization.cs deleted file mode 100644 index b5f499224ac6..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.Serialization.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class TaskIdentifier : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WriteEndObject(); - } - - internal static TaskIdentifier DeserializeTaskIdentifier(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new TaskIdentifier(taskName); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TaskIdentifier FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTaskIdentifier(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.cs deleted file mode 100644 index f78d1e8a48e8..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// Base task object. - internal partial class TaskIdentifier - { - /// Initializes a new instance of . - public TaskIdentifier() - { - } - - /// Initializes a new instance of . - /// - internal TaskIdentifier(string taskName) - { - TaskName = taskName; - } - - /// Gets or sets the task name. - public string TaskName { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.Serialization.cs deleted file mode 100644 index 3c281c4bc939..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.Serialization.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class TaskParameters : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(LoggingOptOut)) - { - writer.WritePropertyName("loggingOptOut"u8); - writer.WriteBooleanValue(LoggingOptOut.Value); - } - writer.WriteEndObject(); - } - - internal static TaskParameters DeserializeTaskParameters(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? loggingOptOut = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("loggingOptOut"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loggingOptOut = property.Value.GetBoolean(); - continue; - } - } - return new TaskParameters(loggingOptOut); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TaskParameters FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTaskParameters(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.cs deleted file mode 100644 index 495f0fe7e626..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// Base parameters object for a text analysis task. - internal partial class TaskParameters - { - /// Initializes a new instance of . - public TaskParameters() - { - } - - /// Initializes a new instance of . - /// - internal TaskParameters(bool? loggingOptOut) - { - LoggingOptOut = loggingOptOut; - } - - /// Gets or sets the logging opt out. - public bool? LoggingOptOut { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.Serialization.cs deleted file mode 100644 index 414966c13e58..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.Serialization.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class TaskState : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - - internal static TaskState DeserializeTaskState(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset lastUpdateDateTime = default; - TextAnalyticsOperationStatus status = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("lastUpdateDateTime"u8)) - { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); - continue; - } - } - return new TaskState(lastUpdateDateTime, status); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TaskState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTaskState(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.cs deleted file mode 100644 index ba59841c4775..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The TaskState. - internal partial class TaskState - { - /// Initializes a new instance of . - /// - /// - public TaskState(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status) - { - LastUpdateDateTime = lastUpdateDateTime; - Status = status; - } - - /// Gets or sets the last update date time. - public DateTimeOffset LastUpdateDateTime { get; set; } - /// Gets or sets the status. - public TextAnalyticsOperationStatus Status { get; set; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Tasks.Serialization.cs similarity index 85% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Tasks.Serialization.cs index 1095e91649ae..00d3118e3430 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Tasks.Serialization.cs @@ -10,9 +10,9 @@ namespace Azure.AI.TextAnalytics.Models { - internal partial class AnalyzeTasks + internal partial class Tasks { - internal static AnalyzeTasks DeserializeAnalyzeTasks(JsonElement element) + internal static Tasks DeserializeTasks(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -60,15 +60,15 @@ internal static AnalyzeTasks DeserializeAnalyzeTasks(JsonElement element) continue; } } - return new AnalyzeTasks(completed, failed, inProgress, total, items ?? new ChangeTrackingList()); + return new Tasks(completed, failed, inProgress, total, items ?? new ChangeTrackingList()); } /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static AnalyzeTasks FromResponse(Response response) + internal static Tasks FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content); - return DeserializeAnalyzeTasks(document.RootElement); + return DeserializeTasks(document.RootElement); } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Tasks.cs similarity index 64% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Tasks.cs index dfb2aaacde11..f25e08b0c874 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTasks.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Tasks.cs @@ -9,15 +9,15 @@ namespace Azure.AI.TextAnalytics.Models { - /// The TasksStateTasks. - internal partial class AnalyzeTasks + /// Container for the tasks status for the LRO job. + internal partial class Tasks { - /// Initializes a new instance of . - /// - /// - /// - /// - internal AnalyzeTasks(int completed, int failed, int inProgress, int total) + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + internal Tasks(int completed, int failed, int inProgress, int total) { Completed = completed; Failed = failed; @@ -26,16 +26,17 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total) Items = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// - /// - /// - /// + /// 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 . /// - internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IReadOnlyList items) + internal Tasks(int completed, int failed, int inProgress, int total, IReadOnlyList items) { Completed = completed; Failed = failed; @@ -44,16 +45,16 @@ internal AnalyzeTasks(int completed, int failed, int inProgress, int total, IRea Items = items; } - /// Gets the completed. + /// Count of completed tasks. public int Completed { get; } - /// Gets the failed. + /// Count of failed tasks. public int Failed { get; } - /// Gets the in progress. + /// Count of inprogress tasks. public int InProgress { get; } - /// Gets the total. + /// Count of total tasks. public int Total { get; } /// - /// Gets the items + /// 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 . /// diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.Serialization.cs deleted file mode 100644 index 36b44f167d4e..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class TasksState - { - internal static TasksState DeserializeTasksState(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AnalyzeTasks tasks = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tasks"u8)) - { - tasks = AnalyzeTasks.DeserializeAnalyzeTasks(property.Value); - continue; - } - } - return new TasksState(tasks); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static TasksState FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeTasksState(document.RootElement); - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.cs deleted file mode 100644 index 1d37bb1bebd0..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.AI.TextAnalytics.Models -{ - /// The TasksState. - internal partial class TasksState - { - /// Initializes a new instance of . - /// - /// is null. - internal TasksState(AnalyzeTasks tasks) - { - Argument.AssertNotNull(tasks, nameof(tasks)); - - Tasks = tasks; - } - - /// Gets the tasks. - public AnalyzeTasks Tasks { get; } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextAnalyticsOperationStatus.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextAnalyticsOperationStatus.cs index 52e0d5d885a3..c3ae113e1c92 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextAnalyticsOperationStatus.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextAnalyticsOperationStatus.cs @@ -10,7 +10,7 @@ namespace Azure.AI.TextAnalytics { - /// The State. + /// The status of the task at the mentioned last update time. public readonly partial struct TextAnalyticsOperationStatus : IEquatable { private readonly string _value; @@ -25,25 +25,25 @@ public TextAnalyticsOperationStatus(string 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"; - private const string PartiallyCompletedValue = "partiallyCompleted"; - /// notStarted. + /// Not started status. public static TextAnalyticsOperationStatus NotStarted { get; } = new TextAnalyticsOperationStatus(NotStartedValue); - /// running. + /// Running status. public static TextAnalyticsOperationStatus Running { get; } = new TextAnalyticsOperationStatus(RunningValue); - /// succeeded. + /// Succeeded status. public static TextAnalyticsOperationStatus Succeeded { get; } = new TextAnalyticsOperationStatus(SucceededValue); - /// failed. + /// Partially completed status. + public static TextAnalyticsOperationStatus PartiallyCompleted { get; } = new TextAnalyticsOperationStatus(PartiallyCompletedValue); + /// Failed status. public static TextAnalyticsOperationStatus Failed { get; } = new TextAnalyticsOperationStatus(FailedValue); - /// cancelled. + /// Cancelled status. public static TextAnalyticsOperationStatus Cancelled { get; } = new TextAnalyticsOperationStatus(CancelledValue); - /// cancelling. + /// Cancelling status. public static TextAnalyticsOperationStatus Cancelling { get; } = new TextAnalyticsOperationStatus(CancellingValue); - /// partiallyCompleted. - public static TextAnalyticsOperationStatus PartiallyCompleted { get; } = new TextAnalyticsOperationStatus(PartiallyCompletedValue); /// Determines if two values are the same. public static bool operator ==(TextAnalyticsOperationStatus left, TextAnalyticsOperationStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentBatchStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentBatchStatistics.Serialization.cs index 028d17db1a0c..08909f1aa57d 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentBatchStatistics.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentBatchStatistics.Serialization.cs @@ -6,26 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics { - public partial class TextDocumentBatchStatistics : IUtf8JsonSerializable + public partial class TextDocumentBatchStatistics { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("documentsCount"u8); - writer.WriteNumberValue(DocumentCount); - writer.WritePropertyName("validDocumentsCount"u8); - writer.WriteNumberValue(ValidDocumentCount); - writer.WritePropertyName("erroneousDocumentsCount"u8); - writer.WriteNumberValue(InvalidDocumentCount); - writer.WritePropertyName("transactionsCount"u8); - writer.WriteNumberValue(TransactionCount); - writer.WriteEndObject(); - } - internal static TextDocumentBatchStatistics DeserializeTextDocumentBatchStatistics(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -69,13 +54,5 @@ internal static TextDocumentBatchStatistics FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeTextDocumentBatchStatistics(document.RootElement); } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentStatistics.Serialization.cs index 2db251fd6f75..ee0f738f4647 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentStatistics.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TextDocumentStatistics.Serialization.cs @@ -6,22 +6,11 @@ #nullable disable using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics { - public partial struct TextDocumentStatistics : IUtf8JsonSerializable + public partial struct TextDocumentStatistics { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("charactersCount"u8); - writer.WriteNumberValue(CharacterCount); - writer.WritePropertyName("transactionsCount"u8); - writer.WriteNumberValue(TransactionCount); - writer.WriteEndObject(); - } - internal static TextDocumentStatistics DeserializeTextDocumentStatistics(JsonElement element) { int charactersCount = default; @@ -49,13 +38,5 @@ internal static TextDocumentStatistics FromResponse(Response response) using var document = JsonDocument.Parse(response.Content); return DeserializeTextDocumentStatistics(document.RootElement); } - - /// Convert into a . - internal RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.Serialization.cs index 85560ae95565..99b5acf2e99c 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.Serialization.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.Serialization.cs @@ -7,63 +7,45 @@ using System; using System.Text.Json; -using Azure.Core; namespace Azure.AI.TextAnalytics.Models { - internal partial class UnknownAnalyzeTextLROResult : IUtf8JsonSerializable + internal partial class UnknownAnalyzeTextLROResult { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WritePropertyName("lastUpdateDateTime"u8); - writer.WriteStringValue(LastUpdateDateTime, "O"); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WriteEndObject(); - } - internal static UnknownAnalyzeTextLROResult DeserializeUnknownAnalyzeTextLROResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - AnalyzeTextLROResultsKind kind = "Unknown"; - string taskName = default; DateTimeOffset lastUpdateDateTime = default; TextAnalyticsOperationStatus status = default; + string taskName = default; + AnalyzeTextLROResultsKind kind = "Unknown"; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind"u8)) + if (property.NameEquals("lastUpdateDateTime"u8)) { - kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("taskName"u8)) + if (property.NameEquals("status"u8)) { - taskName = property.Value.GetString(); + status = new TextAnalyticsOperationStatus(property.Value.GetString()); continue; } - if (property.NameEquals("lastUpdateDateTime"u8)) + if (property.NameEquals("taskName"u8)) { - lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + taskName = property.Value.GetString(); continue; } - if (property.NameEquals("status"u8)) + if (property.NameEquals("kind"u8)) { - status = new TextAnalyticsOperationStatus(property.Value.GetString()); + kind = new AnalyzeTextLROResultsKind(property.Value.GetString()); continue; } } - return new UnknownAnalyzeTextLROResult(lastUpdateDateTime, status, kind, taskName); + return new UnknownAnalyzeTextLROResult(lastUpdateDateTime, status, taskName, kind); } /// Deserializes the model from a raw response. @@ -73,13 +55,5 @@ internal static UnknownAnalyzeTextLROResult DeserializeUnknownAnalyzeTextLROResu using var document = JsonDocument.Parse(response.Content); return DeserializeUnknownAnalyzeTextLROResult(document.RootElement); } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } } } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.cs index c0cd7664f0b0..165b2f79f81b 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROResult.cs @@ -13,11 +13,11 @@ namespace Azure.AI.TextAnalytics.Models internal partial class UnknownAnalyzeTextLROResult : AnalyzeTextLROResult { /// Initializes a new instance of . - /// - /// - /// Enumeration of supported Text Analysis long-running operation task results. - /// - internal UnknownAnalyzeTextLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, AnalyzeTextLROResultsKind kind, string taskName) : base(lastUpdateDateTime, status, kind, taskName) + /// 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. + internal UnknownAnalyzeTextLROResult(DateTimeOffset lastUpdateDateTime, TextAnalyticsOperationStatus status, string taskName, AnalyzeTextLROResultsKind kind) : base(lastUpdateDateTime, status, taskName, kind) { Kind = kind; } diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.Serialization.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.Serialization.cs deleted file mode 100644 index 93294168dcee..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.Serialization.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.TextAnalytics.Models -{ - internal partial class UnknownAnalyzeTextLROTask : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (Optional.IsDefined(TaskName)) - { - writer.WritePropertyName("taskName"u8); - writer.WriteStringValue(TaskName); - } - writer.WriteEndObject(); - } - - internal static UnknownAnalyzeTextLROTask DeserializeUnknownAnalyzeTextLROTask(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - AnalyzeTextLROTaskKind kind = "Unknown"; - string taskName = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("kind"u8)) - { - kind = new AnalyzeTextLROTaskKind(property.Value.GetString()); - continue; - } - if (property.NameEquals("taskName"u8)) - { - taskName = property.Value.GetString(); - continue; - } - } - return new UnknownAnalyzeTextLROTask(taskName, kind); - } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static new UnknownAnalyzeTextLROTask FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeUnknownAnalyzeTextLROTask(document.RootElement); - } - - /// Convert into a . - internal override RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this); - return content; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.cs deleted file mode 100644 index 97ce51e05c78..000000000000 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.AI.TextAnalytics.Models -{ - /// Unknown version of AnalyzeTextLROTask. - internal partial class UnknownAnalyzeTextLROTask : AnalyzeTextLROTask - { - /// Initializes a new instance of . - /// - /// Enumeration of supported long-running Text Analysis tasks. - internal UnknownAnalyzeTextLROTask(string taskName, AnalyzeTextLROTaskKind kind) : base(taskName, kind) - { - Kind = kind; - } - } -} diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextTaskResult.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextTaskResult.cs index 3dcb18adc922..e60bd7fb241f 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextTaskResult.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextTaskResult.cs @@ -11,7 +11,7 @@ namespace Azure.AI.TextAnalytics.Models internal partial class UnknownAnalyzeTextTaskResult : AnalyzeTextTaskResult { /// Initializes a new instance of . - /// Enumeration of supported Text Analysis task results. + /// The kind of task result. internal UnknownAnalyzeTextTaskResult(AnalyzeTextTaskResultsKind kind) : base(kind) { Kind = kind; diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/TextAnalyticsModelFactory.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/TextAnalyticsModelFactory.cs index 9556c557bacb..69e607e9fa49 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/TextAnalyticsModelFactory.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/TextAnalyticsModelFactory.cs @@ -5,6 +5,9 @@ #nullable disable +using System; +using System.Collections.Generic; + namespace Azure.AI.TextAnalytics { /// Model factory for models. diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md b/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md index d94ea8061331..4b896b6f934e 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md @@ -7,7 +7,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: -- https://github.com/Azure/azure-rest-api-specs/blob/53240ebc58b3c4e99de723194032064db1d97e63/specification/cognitiveservices/data-plane/Language/stable/2023-04-01/analyzetext.json +- https://github.com/Azure/azure-rest-api-specs/blob/c6bd27bea6db565d570a019743f836d0925b106d/specification/cognitiveservices/data-plane/Language/stable/2023-04-01/analyzetext.json generation1-convenience-client: true ```