From 7e15e0d1e8a7987b203bd0da34ede16fcb61d7b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D8=A8=D9=84=D8=A7=D9=84=20=D9=85=D8=B3=D9=84=D9=88=D8=A8?= Date: Sat, 20 Jul 2024 04:07:42 +0200 Subject: [PATCH] Sdk auto/29622/azure.ai.language.analyze text (#8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * update API for `Azure.Core.Experimental` (#44830) * Update AutoRest C# version to 3.0.0-beta.20240701.2 (#44832) * Update Generator Version 3.0.0-beta.20240701.2 * Update SDK codes de_he_2 * Update SDK codes ad_co_0 * Update SDK codes mi_pu_4 * Update SDK codes pu_sq_5 * Update SDK codes he_me_3 * Update SDK codes co_de_1 * mitigate breaking changes --------- Co-authored-by: Wei Hu * Azure.Compute.Batch inital checkin (#44524) * inital checkin of azure.compute.batch --------- Co-authored-by: Jesse Squire * Fix SetState() not work (#44819) * Fix SetState not work * Fix namespace. * Add API updates. * Fix spelling issues in all subpackages READMEs (#44844) * Increment package version after release of Azure.Compute.Batch (#44838) * Fixing constant in BlobSourceCheckpointData to have correct schema size (#44839) * [Storage] [DataMovement] [Shares] Preserve Permission Key (#44696) * WIP * Preserve Single Transfer Permissions; Rerecorded failing tests * Cleanup * Preserve permission key defaults to false * PR Comments * Removed unnecessary ResourceProperties in ShareDirectoryResource; Fixed LastWritten values; preserve permissions * Rerecord tests * Revert assests.json to main * Rerecord tests * Rerecord test to hopefully resolve merge conflict assets tag * Added end to end tests for short permission values * Sync eng/common directory with azure-sdk-tools for PR 8528 (#44826) * Fix default value for env vars in build-test-resource-config template * Add empty pool condition --------- Co-authored-by: Ben Broderick Phillips * Updated entra auth events readme (#44178) * Updated readme * Updated changelog.md * feedback changes and updated links * Updated links and feedback suggestions * Updated version and lowercase ref link * Feedback changes * Copied learn documentation to readme * Added required titles to readme * Updated structure * removed locale from urls * Feedback changes * Added required section * Feedback updates * Updated layout to match other readme files * Sync eng/common directory with azure-sdk-tools for PR 8516 (#44799) * Ensure subConfigFiles is not an empty string * Skip instances where $file is an empty string --------- Co-authored-by: Daniel Jurek * Sync eng/common directory with azure-sdk-tools for PR 8549 (#44841) * commit the file changes so that we can see them running * use standalone tool --------- Co-authored-by: Scott Beddall (from Dev Box) * Update AutoRest C# version to 3.0.0-beta.20240703.5 (#44865) * Update Generator Version 3.0.0-beta.20240703.5 * Update SDK codes de_he_2 * Update SDK codes he_me_3 * Update SDK codes ad_co_0 * Update SDK codes st_wo_6 * Update SDK codes mi_pu_4 * Update SDK codes pu_sq_5 * Update SDK codes co_de_1 * update identity version --------- Co-authored-by: Arcturus Zhang * Deployment stacks sdk introduction (#44405) * [SQL] Generating the .NET Sdk for adding manual cutover and OperationPhaseDetails parameter In forward Migration v2 workflow for Migrating Azure sterling Db to azure Hyperscale DB (#44470) * Avoid ServiceBusSenderOptions allocations (#44856) - Avoid allocating empty `ServiceBusSenderOptions` instances when creating instances of `ServiceBusSender`. - Fix tests that fail if the machine they are run on does not use US date formatting. * Increment package version after release of Azure.ResourceManager.Resources (#44871) * Increment package version after release of Azure.ResourceManager.Sql (#44872) * Increment package version after release of Azure.ResourceManager.OracleDatabase (#44867) * Update GenerateAndBuildLib.ps1 (#44874) Don't set 'installInstructions' when it's null, otherwise it would fail the schema validation of 'generateOutput'. * [Api Management] Bump up api version to latest stable 2022-08-01 (#44074) * [KeyVault] Bump API version to 2023-07-01 (#44690) * Increment package version after release of Azure.ResourceManager.ApiManagement (#44876) * Increment package version after release of Azure.ResourceManager.KeyVault (#44877) * Delete eng/common/InterdependencyGraph.html which is unused. (#44860) Co-authored-by: Wes Haggard * [Azure OpenAI] Pin OpenAI version (#44708) Pin OpenAI version, which is used by Azure OpenAI. * MSAL logging levels now correlate with the `AzureEventSourceListener` configured log level (#44631) * Creating SDT client with endpoint only and making source input options public (#44862) * SouceInput options are made public. Tests are updated to access stoarge accounts using managed identity and no loger through SAS urls. Single document translation client can be created using endpoint alone, mainly for SDK to work against containers. * Updating commit ID of specs repo to the latest * Fixing build and analyze failures * Fixing build errors * Fixing tests failing in MacOS by updating Default credentials with Token credentials while creating BlobServiceClient * Test recordings validated and updated * Update AutoRest C# version to 3.0.0-beta.20240707.1 (#44888) * Update Generator Version 3.0.0-beta.20240707.1 * Update SDK codes co_de_1 * Fix for BearerTokenAuthenticationPolicy hang (#44882) * Skip project reference tests for openai (#44896) * Update GitHubEventProcessor version to 1.0.0-dev.20240708.1 (#44898) Co-authored-by: James Suplizio * Make @Azure/azure-sdk-eng the owner of .github/workflows (#44900) * Increment package version after release of Azure.AI.Translation.Document (#44895) * Sync eng/common directory with azure-sdk-tools for PR 8558 (#44863) * Support storage network access and worm removal in remove test resources script * Move storage network access script to common resource helpers file * Improve storage container deletion resilience * Plumb through pool variable to live test cleanup template * Add sleep for network rule application --------- Co-authored-by: Ben Broderick Phillips * ClientModel: Updates to paging types to support sub-client enumerator pattern (#44825) * Initial checkin of changes to paging APIs * nits * rename ToValueCollection method to GetAllValues * nits * Add back simplified PageToken; otherwise implementations must always deserialize before using * rename to ClientToken for general use with LRO rehydration as well * nits * make ClientToken non-abstract * nits * proposed renames * backup idea; I'm wondering if RequestOptions can always be handled by the closure * remove RequestOptions from signatures * nits * GetPageCore - enable an overload that doesn't take a page token * Change GetPage with no parameters to GetFirstPage * rename ClientToken to ContinuationToken and remove GetFirstPage method * some updates based on feedback from Krzysztof * add Async suffix * move to CurrentPageToken instead of FirstPageToken * simplified page collection * tidy * tidy * implement interface explicitly * reimplement GetAllValues to account for possibility GetCurrentPage was called first * add internal emitted files that generated code will use * Add stubs for mock paging client * flush out client a bit * updates * Backup of mock client WIP * rework/rename and add tests prior to implementation * make first test pass * sync tests all pass * backup sync async test base paging tests idea * separate unit and scenario tests * clean up sync unit tests * add async unit tests * Add GetCurrentPageCore so that GetCurrentPage doesn't advance enumerator * complete sync scenario tests * Add async tests * nits * Add refdocs * address pr feedback on clarifying refdoc comments * update OAI Test csproj to opt out of project reference pipeline * add more ExcludeFromProjectReferenceToConversion * add more ExcludeFromProjectReferenceToConversion * move build variables * temporarily opt-out Azure.Core.TestFramework * revert TestFramework change and do it for Azure.Core instead * try it without OAI csproj mods * Avoid ServiceBus*Options allocations (#44885) - Avoid allocating empty `ServiceBusClientOptions` and `ServiceBusProcessorOptions` instances when creating instances of `ServiceBusClient` and `ServiceBusProcessor`. - Remove unused `ServiceBusSenderOptions.Clone()` method. * [Schema Registry] Generating from TypeSpec for JSON GA (#44881) * regenerating * API * cleanup files * test recordings * clean up Avro package * cleaned up too much... * fix test recordings * [Azure.Core] GeoJsonConverter serialization fix (#44835) * GeoJsonConverter serialization fix * formatting * formatting * Update GeoJsonConverter.cs * Update CHANGELOG.md * add comment * Increment Microsoft.Azure.Functions.Worker.Extensions.WebPubSub version (#44880) Also update version increment script to error on missing version property. * Use eng/common template for create-tags-and-git-release (#44921) * Use eng/common template for create-tags-and-git-release * Package-2024-01-01 (#44868) * Package-2024-01-01 * script ran * workaround of breaking changes - fix breaking change in GetExpressRouteCrossConnections - fix breaking change in InboundSecurityRule - add backward compatibility of `FirewallPacketCaptureContent` - update api interface * fix change log version check error * fix release date * remove [Obsolete] and fix extension implementation error --------- Co-authored-by: Mingzhe Huang (from Dev Box) * Turn off WarningsAsErrors until we bump System.Text.Json (#44931) * address null purpose check in FileClient GetFiles (#44923) * Fix typo in TestEnvironment variable SYSTEM_ACCESSTOKEN (#44933) * Update CHANGELOG entry for Assistants package (#44918) * [Communication][Email] Updating CHANGELOG for version 1.1.0-beta.1 (#44934) * [Communication][Email] Updating CHANGELOG for version 1.2.0-beta.1 * Changing version to 1.1.0-beta.1 * add the ability to override default succeeded() conditioning by parameter (#44937) Co-authored-by: Scott Beddall * Azure Redis .Net SDK update for new api v2024-03-01 (#44847) * Update autorest and generated code * Update ArmRedisModelFactory customization code and generate API file * Add tests for disable access keys auth * Update changelog * Push recordings * Change csproj version * Update changelog * Update arm model factory customization * Update arm model factory customization code with named arguments * Update release date in CHANGELOG --------- Co-authored-by: Kanchan Joshi * Update AutoRest C# version to 3.0.0-beta.20240710.2 (#44947) * Update Generator Version 3.0.0-beta.20240710.2 * Update SDK codes de_he_2 * Update SDK codes st_wo_6 * Update SDK codes mi_pu_4 * Update SDK codes he_me_3 * Update SDK codes co_de_1 * try to fix spec --------- Co-authored-by: tadelesh * refine a new api in redis (#44948) * refine a new api in redis * fix test cases * fix(docs): wrong location in `System.ClientModel` (#44943) * fix(docs): wrong location in `System.ClientModel` * Update parameter description to make the meaning more clear. Co-authored-by: Jesse Squire --------- Co-authored-by: Jesse Squire * Preparation for release of Azure.Core 1.41.0 (#44938) * Update AutoRest C# version to 3.0.0-beta.20240711.1 (#44953) * Preparation for release of System.ClientModel v1.1.0-beta.5 (#44939) * Preparation for release of System.ClientModel v1.1.0-beta.5 * updates per pr fb * Support regex/negative regex filters for stress test discovery. Add storage env defaults (#44936) Co-authored-by: Ben Broderick Phillips * remove broken links from Core changelogs to address link checker issue (#44958) * [Service Bus] Enforce batch limits (#44917) * [Service Bus] Enforce batch limits The focus of these changes is to add client-side logic to force the maximum size for batches when large message support is enabled and to enforce the undocumented 4,500 message limit for a single batch. * Update azure-sdk-build-tools Repository Resource Refs in Yaml files (#44859) * Increment version for core releases (#44964) * Increment package version after release of System.ClientModel * Increment package version after release of Azure.Core * Removed Entra App Secrets from Storage tests (#44427) * [KeyVault] Sample depedency versions (#44919) * [KeyVault] Sample depedency versions The focus of these changes is to bump the versions used by the sample. The current Identity reference is flagged for vulnerabilities. * Update sdk/keyvault/samples/getcert/getcert.csproj * Increment package version after release of Azure.Communication.Email (#44957) * [EngSys] Clean up local debug code (#44978) The focus of these changes is to remove what appears to be local debug code that should not have made it into `main`. * [KeyVault] More sample dependency versions (#44920) * [KeyVault] More sample dependency versions The focus of these changes is to bump dependency versions used in the Share Link sample, moving to a non-vulnerable Identity version. Because Core is a transitive dependency, removed the explicit reference. * Update sdk/keyvault/samples/sharelink/ShareLink.csproj * Update Core package version for Azure.Core 1.41.0 release (#44980) * Prepare for release (#44982) * Disabling all CallingServer test as it is in the process of decomissioning (#44979) * Adding some verbose output to help diagnose something going awry with docs gen (#44965) * Adding some verbose output to help diagnose something going awry with docs gen * see what happens if there is no target * update commands that fail to log warnings * [EngSys] Remove baseline error (#44985) The focus of these changes is to remove a baseline error suppression for an account that is no longer an active Microsoft contributor. * [CODEOWNERS] Remove invalid account (#44984) Removing a legacy account that the linter is now flagging as invalid. * Sync eng/common directory with azure-sdk-tools for PR 8598 (#44935) * Set storage account test resources to disable blob public access * Skip adding network rules to storage accounts that don't need them during cleanup * Add succeeded check to set pipeline subnet info step * Disable network firewall by default in resource creation/removal --------- Co-authored-by: Ben Broderick Phillips * fix(otel logging): Include ILogger CategoryName in logger output (#44754) * fix(telemetry transmission): Include ILogger CategoryName in logger output Previously this field was omitted, which was not consistent with normal ILogger behavior, or with Application Insights classic behavior. fixes: #44746 * improve(otel exporter tests): Verify that logger CategoryName is in Exception log entries * improve(live metrics): Include LogRecord.CategoryName in live metrics It's included in live metrics using app insights classic, so should be included here too. * docs(changelog): Update changelog with "add CategoryName" info * prep exporter release 1.4.0-beta1 (#44981) * Fix EventGrid Namespaces readme (#44992) * update Versions of the packages (#44988) * Updating dotnet sdk for NewRelic (#44852) * Increment package version after release of Azure.ResourceManager.Redis (#44997) * Increment package version after release of Azure.ResourceManager.NewRelicObservability (#45001) * [CODEOWNERS] Removing Pallavi's ownership (#45006) The focus of these changes is to remove ownership areas for Pallavi, as their account is no longer associated with Microsoft. * [Storage] Fix for truncating URL paths with "#" (#44941) * WIP - still need to record tests * Recordings * Cleanup * Fixed recordings * Added fix for Shares and Datalake, Updated tests to use OAuth, Updated Changelogs * Rerecord files tests * Merge and record tests * [Azure.Data.Tables] DeleteEntity overload (#44986) * overload method * Update API * Update samples * Update changelog * Fix error in parameter description * [Schema Registry] Default SchemaFormat to the Content-Type header value (#45007) * fixes * fixes * clean up client * Add Update Remove-Item command line options (#45010) * update integration test with CategoryName (#44989) * Reenabled live Audience tests (#44972) * Cncf namespace samples (#44994) * Add CNCF sample * Update readme * new recordings * event * recording * Use dynamic * [Storage] [WebJobs] Added test for Blob Path for various blob names to check for blob name validation (#45015) * Added test for Blob Path for possible blob names, to ensure paths are not truncated * CI changelog error * Fix CI change log part 2 * Azure OpenAI: sample/snippet update (request options for On Your Data) (#44956) * Update README.md The 'options' is needed to use own data and Search engine: ChatCompletion completion = chatClient.CompleteChat( [ new UserChatMessage("How to troubleshoot high cpu at user pool level"), ], options); * sample->snippet update --------- Co-authored-by: Liwei Yin <43456062+Liwei-Yin@users.noreply.github.com> * Storage STG 94 GA release (#45018) * Update AutoRest C# version to 3.0.0-beta.20240715.1 (#45020) * Update Generator Version 3.0.0-beta.20240715.1 * Update SDK codes co_de_1 * remove unused configuration.json and tspCodeModel.json --------- Co-authored-by: FAREAST\chunyu * Increment package version after release of Microsoft.Azure.WebJobs.Extensions.AuthenticationEvents (#45011) * Update AutoRest C# version to 3.0.0-beta.20240716.2 (#45027) * Update Generator Version 3.0.0-beta.20240716.2 * Update SDK codes de_he_2 * Update SDK codes he_me_3 * Update SDK codes st_wo_6 * Update SDK codes ad_co_0 * Update SDK codes mi_pu_4 * Update SDK codes pu_sq_5 * fix compilation error due to parameter name changes --------- Co-authored-by: Mingzhe Huang (from Dev Box) * Temporarily disable MSDocs publishing for Azure.Messaging.EventGrid.SystemEvents (#45033) * [AzureMonitor] add links to docs in the Readme (#45017) * add links to docs in the Readme * pr feedback * Remove duplicate SYSTEM_ACCESSTOKEN (#45004) * Fixing target base scale instance concurrency for queues (#44661) * Fixing target base scale instance concurrency for queues * New commit * Adding changelog notes * Fix --------- Co-authored-by: Amanda Nguyen * [Azure.Communication.Messages] Update README (#44987) * Update Azure.Communication.Messages README * Increment package version after release of Azure.Monitor.OpenTelemetry.Exporter (#45037) * Increment version for storage releases (#45039) * Update Preview Test Sub to use new connection (#45035) In order to get both deployment and clean-up working we need to have a connection that points at the right subscription. Today azure-sdk-tests points to the name Test Sub but I created azure-sdk-tests-preview connection which points to the Preview Test Sub. This will fix the clean-up step which is currently failing for things deployed in Preview. * Bumped Storage, Blobs, and Queues package dependency version (#45016) * [Storage] [DataMovement] Improve checking on part completion for pause/stop/completion status (#45038) * WIP * Make CI happy * Revert "Make CI happy" This reverts commit a7e80cfc27850b62075ea05c22475080ed79b7f4. * WIP * Cleanup * More cleanup * Updated Changelog for DataMovement July Release (#45040) * [AzureMonitorDistro] prep distro 1.3.0-beta.1 (#44991) * prep distro 1.3.0-beta.1 * change to package reference * Changed DataMovement Blobs and File Shares to use package dependency, Added File Shares to packages.data.props (#45042) * Increment package version after release of Azure.Monitor.OpenTelemetry.AspNetCore (#45043) * Increment version for storage releases (#45045) * [Storage] [Webjobs Extension] Updated changelog to prepare for WebJobs Storage Extension release (#45041) * Increment version for storage releases (#45054) * Update Changelog and readme files to include --prerelease (#45047) * Update Changelog File to include release date. * Update Readme to add --prerelease option * Increment package version after release of Azure.Messaging.EventGrid (#45056) * [Search] GA Features for API Version 2024-07-01 (#44485) * [Search] GA Features for API Version 2024-07-01 * [AzureMonitor] add Log Scopes example to Readme (#44749) * add Log Scopes example to Readme * pr feedback * add AzureMonitor to example code * pr feedback * Update sdk/monitor/Azure.Monitor.OpenTelemetry.Exporter/README.md Co-authored-by: Cijo Thomas * add another test * pr feedback * pr feedback * Update sdk/monitor/Azure.Monitor.OpenTelemetry.AspNetCore/README.md Co-authored-by: Rajkumar Rangaraj * fix * pr feedback --------- Co-authored-by: Cijo Thomas Co-authored-by: Rajkumar Rangaraj * Prepare release for mysql 1.1.0 (#45051) * Increment package version after release of Azure.ResourceManager.MySql (#45067) * Increment package version after release of Azure.Search.Documents (#45062) * [AppService] Bump api version to 2023-12-01 (#43706) * [Azure.Messaging.EventHubs] Prepare for release (#45061) * [Event Hubs] Prepare for release * update version number to be greater than the beta * update version * Remove duplicate credential instantiation line in ACS Email README (#45076) * [Service Bus] July 2024 release prep (#45075) * Preparation for the July 2024 release. * Nightly docs publish should honor skipPublishDocMs (#45077) * Increment package version after release of Azure.Messaging.EventHubs (#45079) * [Service Bus] Change log typo (#45082) The focus of these changes is to fix a typo that collapsed bullet points into one item. * Sync eng/common directory with azure-sdk-tools for PR 8602 (#45019) * add additional argument to Save-Package-Properties to allow for usage in pull request context --------- Co-authored-by: Scott Beddall (from Dev Box) Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com> Co-authored-by: Wes Haggard * [Azure.Messaging.EventHubs.Processor] Prepare for release (#45063) * updates * version * updates * [Azure.Data.Tables] Update version for release (#45058) * Update release version in Changelog and project * Update release date * [Storage] [Tests] Fix OAuth Storage Samples (#45083) * Fix storage samples * Update snippets * Increment version for eventhub releases (#45085) * Increment package version after release of Azure.Messaging.EventHubs.Processor * Update Azure.Messaging.EventHubs.Processor.csproj * Update CHANGELOG.md --------- Co-authored-by: Madalyn Redding <66138537+m-redding@users.noreply.github.com> * Reformat DefaultAzureCredential flow chart (#45086) * Using federated auth for ACS tests (#44886) * Using federated auth for ACS tests * Removing usage of secrets for Shortcodes * Removing PPE and INT Live tests * Addressing comments to maintain consistency across languages * Updated Storage codeowners (#45088) * Add exception information for all credential classes (#44633) * Increment package version after release of Azure.Messaging.ServiceBus (#45087) * Adding a new field (#45012) * Release preview version 2024-05-20 of HybridCompute (#44654) * Update AutoRest C# version to 3.0.0-beta.20240719.2 (#45097) * Update Generator Version 3.0.0-beta.20240719.2 * Update SDK codes mi_pu_4 * Update DefaultAzureCredential, InteractiveBrowserCredential, and DeviceCodeCredential docs (#45009) * Increment package version after release of Azure.ResourceManager.HybridCompute (#45096) * Increment package version after release of Azure.ResourceManager.GuestConfiguration (#45094) * Unset the SDKType environment variable for API Docs Gen (#45080) * Unset the SDKType environment variable for API Docs Gen * Unsetting didn't work, try a different approach * set /p:BuildInParallel=false on the build commands * for the want of a quote, the kingdom fell * change the mgmt build commands, if those work the if statements will be consolidated * Remove libtype, everything is Taco Bell * Add Azure Health Data Service product slug (#45107) Co-authored-by: Scott Addie * Sync eng/common directory with azure-sdk-tools for PR 8650 (#45057) * missed a condition passthrough --------- Co-authored-by: Scott Beddall Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com> * SCM: Add support for Retry-After header to default ClientRetryPolicy (#45078) * Add support for Retry-After header to default ClientRetryPolicy * Add tests * updates * nits * support http-date format as well * update CHANGELOG * add header collection to mock * CodeGen from PR 29622 in Azure/azure-rest-api-specs Merge 57ad557f71918f567dafc8afbcfd4c2f3125a12f into 09741dc7c9e43a8f9401d782186cac723dc4af71 --------- Co-authored-by: Dapeng Zhang Co-authored-by: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Co-authored-by: Wei Hu Co-authored-by: wiboris <54044985+wiboris@users.noreply.github.com> Co-authored-by: Jesse Squire Co-authored-by: JialinXin Co-authored-by: Jiale Zhang (MSFT) <141405558+zhangjiale-64@users.noreply.github.com> Co-authored-by: Amanda Nguyen <48961492+amnguye@users.noreply.github.com> Co-authored-by: Ben Broderick Phillips Co-authored-by: hakimms <131916587+hakimms@users.noreply.github.com> Co-authored-by: Daniel Jurek Co-authored-by: Scott Beddall (from Dev Box) Co-authored-by: Dante Co-authored-by: Ayush Gupta - SQL <166794972+guptaayush007@users.noreply.github.com> Co-authored-by: Martin Costello Co-authored-by: Ray Chen Co-authored-by: Wenming Liu Co-authored-by: Minghao Chen <30464227+HarveyLink@users.noreply.github.com> Co-authored-by: Wes Haggard Co-authored-by: Jose Arriaga Maldonado <45773732+joseharriaga@users.noreply.github.com> Co-authored-by: Christopher Scott Co-authored-by: hamshavathimunibyraiah <125092972+hamshavathimunibyraiah@users.noreply.github.com> Co-authored-by: James Suplizio Co-authored-by: Anne Thompson Co-authored-by: Madalyn Redding <66138537+m-redding@users.noreply.github.com> Co-authored-by: Patrick Hallisey Co-authored-by: GuptaVertika <149072034+GuptaVertika@users.noreply.github.com> Co-authored-by: Mingzhe Huang (from Dev Box) Co-authored-by: Travis Wilson <35748617+trrwilson@users.noreply.github.com> Co-authored-by: Scott Schaab Co-authored-by: Scott Addie <10702007+scottaddie@users.noreply.github.com> Co-authored-by: yogeshmo <46582228+yogeshmo@users.noreply.github.com> Co-authored-by: Kanchan Joshi <30471843+koderjoker@users.noreply.github.com> Co-authored-by: Kanchan Joshi Co-authored-by: tadelesh Co-authored-by: Mingzhe Huang Co-authored-by: Jesse Squire Co-authored-by: Sean McCullough <44180881+seanmcc-msft@users.noreply.github.com> Co-authored-by: JoshLove-msft <54595583+JoshLove-msft@users.noreply.github.com> Co-authored-by: minwoolee-msft <77083090+minwoolee-msft@users.noreply.github.com> Co-authored-by: John Crim Co-authored-by: Timothy Mothra Co-authored-by: subhra231 Co-authored-by: VIPRAY JAIN <118152689+vipray-ms@users.noreply.github.com> Co-authored-by: Jonathan Cárdenas Co-authored-by: Liwei Yin <43456062+Liwei-Yin@users.noreply.github.com> Co-authored-by: FAREAST\chunyu Co-authored-by: Alexey Rodionov Co-authored-by: Amanda Nguyen Co-authored-by: Meredith Monticello Co-authored-by: ShivangiReja <45216704+ShivangiReja@users.noreply.github.com> Co-authored-by: Cijo Thomas Co-authored-by: Rajkumar Rangaraj Co-authored-by: Arthur Ma Co-authored-by: Scott Beddall <45376673+scbedd@users.noreply.github.com> Co-authored-by: rajuanitha88 <106093972+rajuanitha88@users.noreply.github.com> Co-authored-by: ameyaiam3 <141965277+ameyaiam3@users.noreply.github.com> Co-authored-by: yaotongms <137821665+yaotongms@users.noreply.github.com> Co-authored-by: Scott Addie Co-authored-by: SDKAuto --- .../AILanguageConversationsModelFactory.cs | 950 +++++ .../Generated/ConversationAnalysisClient.cs | 271 +- .../ConversationAnalysisClientExtensions.cs | 32 +- .../ConversationAnalysisClientOptions.cs | 46 + .../Generated/ConversationAuthoringClient.cs | 2803 -------------- .../Docs/ConversationAnalysisClient.xml | 568 +-- .../Docs/ConversationAuthoringClient.xml | 3061 --------------- .../Internal/ChangeTrackingDictionary.cs | 167 + .../Generated/Internal/ChangeTrackingList.cs | 153 + .../Internal/ModelSerializationExtensions.cs | 398 ++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../Models/AgeResolution.Serialization.cs | 151 + .../src/Generated/Models/AgeResolution.cs | 47 + .../src/Generated/Models/AgeUnit.cs | 60 + .../Models/AnalysisConfig.Serialization.cs | 133 + .../src/Generated/Models/AnalysisConfig.cs | 73 + ...eConversationActionResult.Serialization.cs | 126 + .../Models/AnalyzeConversationActionResult.cs | 69 + .../AnalyzeConversationInput.Serialization.cs | 126 + .../Models/AnalyzeConversationInput.cs | 69 + .../Models/AnalyzeConversationInputKind.cs | 48 + ...nversationOperationAction.Serialization.cs | 133 + .../AnalyzeConversationOperationAction.cs | 73 + .../AnalyzeConversationOperationActionKind.cs | 54 + ...onversationOperationInput.Serialization.cs | 164 + .../AnalyzeConversationOperationInput.cs | 99 + ...nversationOperationResult.Serialization.cs | 137 + .../AnalyzeConversationOperationResult.cs | 90 + ...AnalyzeConversationOperationResultsKind.cs | 54 + ...onversationOperationState.Serialization.cs | 258 ++ .../AnalyzeConversationOperationState.cs | 118 + ...AnalyzeConversationResult.Serialization.cs | 154 + .../Models/AnalyzeConversationResult.cs | 98 + .../Models/AnalyzeConversationResultKind.cs | 48 + .../Models/AnswerSpan.Serialization.cs | 183 + .../src/Generated/Models/AnswerSpan.cs | 77 + .../Models/AnswersResult.Serialization.cs | 152 + .../src/Generated/Models/AnswersResult.cs | 66 + .../Models/AreaResolution.Serialization.cs | 151 + .../src/Generated/Models/AreaResolution.cs | 47 + .../src/Generated/Models/AreaUnit.cs | 84 + .../Models/AudioTiming.Serialization.cs | 157 + .../src/Generated/Models/AudioTiming.cs | 69 + .../Models/BooleanResolution.Serialization.cs | 143 + .../src/Generated/Models/BooleanResolution.cs | 41 + ...ConversationActionContent.Serialization.cs | 233 ++ .../Models/ConversationActionContent.cs | 111 + .../ConversationActionResult.Serialization.cs | 143 + .../Models/ConversationActionResult.cs | 44 + .../Models/ConversationActionState.cs | 66 + .../ConversationActions.Serialization.cs | 190 + .../Generated/Models/ConversationActions.cs | 103 + ...ConversationAnalysisInput.Serialization.cs | 135 + .../Models/ConversationAnalysisInput.cs | 75 + ...ConversationCallingConfig.Serialization.cs | 168 + .../Models/ConversationCallingConfig.cs | 73 + .../ConversationConfig.Serialization.cs | 161 + .../Generated/Models/ConversationConfig.cs | 35 + .../Generated/Models/ConversationDomain.cs | 54 + .../ConversationEntity.Serialization.cs | 225 ++ .../Generated/Models/ConversationEntity.cs | 126 + ...ionEntityExtraInformation.Serialization.cs | 128 + .../ConversationEntityExtraInformation.cs | 69 + .../Models/ConversationError.Serialization.cs | 200 + .../src/Generated/Models/ConversationError.cs | 94 + .../Generated/Models/ConversationErrorCode.cs | 99 + .../Models/ConversationInput.Serialization.cs | 136 + .../src/Generated/Models/ConversationInput.cs | 94 + .../ConversationIntent.Serialization.cs | 143 + .../Generated/Models/ConversationIntent.cs | 81 + ...nversationItemLevelTiming.Serialization.cs | 157 + .../Models/ConversationItemLevelTiming.cs | 69 + ...versationPiiActionContent.Serialization.cs | 256 ++ .../Models/ConversationPiiActionContent.cs | 91 + .../Models/ConversationPiiCategories.cs | 75 + .../ConversationPiiCategoryExclusions.cs | 66 + ...ConversationPiiItemResult.Serialization.cs | 161 + .../Models/ConversationPiiItemResult.cs | 90 + ...rsationPiiOperationResult.Serialization.cs | 176 + .../Models/ConversationPiiOperationResult.cs | 49 + .../ConversationPiiResults.Serialization.cs | 186 + .../Models/ConversationPiiResults.cs | 94 + .../ConversationPrediction.Serialization.cs | 182 + .../Models/ConversationPrediction.cs | 53 + ...ersationRequestStatistics.Serialization.cs | 191 + .../Models/ConversationRequestStatistics.cs | 108 + .../ConversationResult.Serialization.cs | 161 + .../Generated/Models/ConversationResult.cs | 83 + .../ConversationStatistics.Serialization.cs | 135 + .../Models/ConversationStatistics.cs | 72 + ...ummarizationActionContent.Serialization.cs | 223 ++ .../ConversationSummarizationActionContent.cs | 96 + ...rsationTargetIntentResult.Serialization.cs | 169 + .../Models/ConversationTargetIntentResult.cs | 42 + .../ConversationalInput.Serialization.cs | 151 + .../Generated/Models/ConversationalInput.cs | 51 + ...alPiiResultWithResultBase.Serialization.cs | 186 + .../ConversationalPiiResultWithResultBase.cs | 94 + ...onversationsSummaryResult.Serialization.cs | 186 + .../Models/ConversationsSummaryResult.cs | 94 + .../CurrencyResolution.Serialization.cs | 162 + .../Generated/Models/CurrencyResolution.cs | 54 + ...ummarizationActionContent.Serialization.cs | 229 ++ ...mConversationSummarizationActionContent.cs | 106 + ...marizationOperationAction.Serialization.cs | 161 + .../CustomSummarizationOperationAction.cs | 35 + ...marizationOperationResult.Serialization.cs | 176 + .../CustomSummarizationOperationResult.cs | 49 + .../CustomSummaryResult.Serialization.cs | 200 + .../Generated/Models/CustomSummaryResult.cs | 101 + .../DateTimeResolution.Serialization.cs | 180 + .../Generated/Models/DateTimeResolution.cs | 61 + .../src/Generated/Models/DateTimeSubKind.cs | 60 + .../Models/DocumentError.Serialization.cs | 143 + .../src/Generated/Models/DocumentError.cs | 82 + .../Models/EntitySubtype.Serialization.cs | 171 + .../src/Generated/Models/EntitySubtype.cs | 39 + .../Models/EntityTag.Serialization.cs | 150 + .../src/Generated/Models/EntityTag.cs | 79 + .../Generated/Models/ExtraInformationKind.cs | 54 + .../InformationResolution.Serialization.cs | 151 + .../Generated/Models/InformationResolution.cs | 47 + .../src/Generated/Models/InformationUnit.cs | 84 + .../src/Generated/Models/InnerErrorCode.cs | 87 + .../Models/InnerErrorModel.Serialization.cs | 201 + .../src/Generated/Models/InnerErrorModel.cs | 94 + .../src/Generated/Models/InputModality.cs | 51 + .../Models/InputWarning.Serialization.cs | 154 + .../src/Generated/Models/InputWarning.cs | 86 + .../ItemizedSummaryContext.Serialization.cs | 151 + .../Models/ItemizedSummaryContext.cs | 87 + .../KnowledgeBaseAnswer.Serialization.cs | 269 ++ .../Generated/Models/KnowledgeBaseAnswer.cs | 95 + ...nowledgeBaseAnswerContext.Serialization.cs | 146 + .../Models/KnowledgeBaseAnswerContext.cs | 76 + ...KnowledgeBaseAnswerDialog.Serialization.cs | 167 + .../Models/KnowledgeBaseAnswerDialog.cs | 70 + ...KnowledgeBaseAnswerPrompt.Serialization.cs | 168 + .../Models/KnowledgeBaseAnswerPrompt.cs | 73 + .../Models/LengthResolution.Serialization.cs | 151 + .../src/Generated/Models/LengthResolution.cs | 47 + .../src/Generated/Models/LengthUnit.cs | 96 + .../Generated/Models/ListKey.Serialization.cs | 146 + .../src/Generated/Models/ListKey.cs | 34 + .../Generated/Models/LogicalOperationKind.cs | 51 + .../Models/LuisCallingConfig.Serialization.cs | 220 ++ .../src/Generated/Models/LuisCallingConfig.cs | 85 + .../Models/LuisConfig.Serialization.cs | 172 + .../src/Generated/Models/LuisConfig.cs | 39 + .../Models/LuisResult.Serialization.cs | 121 + .../src/Generated/Models/LuisResult.cs | 61 + .../LuisTargetIntentResult.Serialization.cs | 169 + .../Models/LuisTargetIntentResult.cs | 42 + .../Models/MetadataFilter.Serialization.cs | 167 + .../src/Generated/Models/MetadataFilter.cs | 70 + .../Models/MetadataRecord.Serialization.cs | 143 + .../src/Generated/Models/MetadataRecord.cs | 82 + ...LanguageConversationInput.Serialization.cs | 145 + .../Models/MultiLanguageConversationInput.cs | 88 + .../Models/NamedEntity.Serialization.cs | 185 + .../src/Generated/Models/NamedEntity.cs | 104 + ...eLinkedTargetIntentResult.Serialization.cs | 169 + .../Models/NoneLinkedTargetIntentResult.cs | 42 + .../src/Generated/Models/NumberKind.cs | 63 + .../Models/NumberResolution.Serialization.cs | 151 + .../src/Generated/Models/NumberResolution.cs | 47 + .../NumericRangeResolution.Serialization.cs | 159 + .../Models/NumericRangeResolution.cs | 53 + .../OrchestrationPrediction.Serialization.cs | 165 + .../Models/OrchestrationPrediction.cs | 57 + .../Models/OrdinalResolution.Serialization.cs | 159 + .../src/Generated/Models/OrdinalResolution.cs | 57 + .../src/Generated/Models/ParticipantRole.cs | 54 + .../PiiOperationAction.Serialization.cs | 161 + .../Generated/Models/PiiOperationAction.cs | 35 + .../Models/PredictionBase.Serialization.cs | 132 + .../src/Generated/Models/PredictionBase.cs | 73 + .../src/Generated/Models/ProjectKind.cs | 51 + .../Models/QueryFilters.Serialization.cs | 182 + .../src/Generated/Models/QueryFilters.cs | 74 + .../QuestionAnsweringConfig.Serialization.cs | 161 + .../Models/QuestionAnsweringConfig.cs | 35 + ...sweringTargetIntentResult.Serialization.cs | 169 + .../QuestionAnsweringTargetIntentResult.cs | 42 + .../QuestionAnswersConfig.Serialization.cs | 280 ++ .../Generated/Models/QuestionAnswersConfig.cs | 101 + .../src/Generated/Models/RangeKind.cs | 75 + .../src/Generated/Models/RankerKind.cs | 51 + ...RedactedTranscriptContent.Serialization.cs | 202 + .../Models/RedactedTranscriptContent.cs | 82 + .../Generated/Models/RedactionCharacter.cs | 87 + .../Models/RegexKey.Serialization.cs | 157 + .../src/Generated/Models/RegexKey.cs | 38 + .../src/Generated/Models/RelativeTo.cs | 54 + .../Models/RequestStatistics.Serialization.cs | 159 + .../src/Generated/Models/RequestStatistics.cs | 90 + .../Models/ResolutionBase.Serialization.cs | 140 + .../src/Generated/Models/ResolutionBase.cs | 69 + .../src/Generated/Models/ResolutionKind.cs | 90 + .../Models/ShortAnswerConfig.Serialization.cs | 172 + .../src/Generated/Models/ShortAnswerConfig.cs | 73 + .../Models/SpeedResolution.Serialization.cs | 151 + .../src/Generated/Models/SpeedResolution.cs | 47 + .../src/Generated/Models/SpeedUnit.cs | 87 + .../src/Generated/Models/StringIndexType.cs | 54 + ...marizationOperationAction.Serialization.cs | 161 + .../Models/SummarizationOperationAction.cs | 35 + ...marizationOperationResult.Serialization.cs | 176 + .../Models/SummarizationOperationResult.cs | 49 + .../src/Generated/Models/SummaryAspect.cs | 63 + .../Generated/Models/SummaryLengthBucket.cs | 54 + .../Models/SummaryResult.Serialization.cs | 186 + .../src/Generated/Models/SummaryResult.cs | 94 + .../Models/SummaryResultItem.Serialization.cs | 168 + .../src/Generated/Models/SummaryResultItem.cs | 87 + .../TargetIntentResult.Serialization.cs | 136 + .../Generated/Models/TargetIntentResult.cs | 84 + .../src/Generated/Models/TargetProjectKind.cs | 57 + .../TemperatureResolution.Serialization.cs | 151 + .../Generated/Models/TemperatureResolution.cs | 47 + .../src/Generated/Models/TemperatureUnit.cs | 60 + .../src/Generated/Models/TemporalModifier.cs | 99 + .../TemporalSpanResolution.Serialization.cs | 201 + .../Models/TemporalSpanResolution.cs | 50 + .../Models/TextConversation.Serialization.cs | 190 + .../src/Generated/Models/TextConversation.cs | 52 + .../TextConversationItem.Serialization.cs | 199 + .../Generated/Models/TextConversationItem.cs | 101 + .../Generated/Models/TranscriptContentType.cs | 57 + .../TranscriptConversation.Serialization.cs | 190 + .../Models/TranscriptConversation.cs | 52 + ...ranscriptConversationItem.Serialization.cs | 268 ++ .../Models/TranscriptConversationItem.cs | 131 + .../UnknownAnalysisConfig.Serialization.cs | 146 + .../Generated/Models/UnknownAnalysisConfig.cs | 29 + ...eConversationActionResult.Serialization.cs | 135 + .../UnknownAnalyzeConversationActionResult.cs | 28 + ...nAnalyzeConversationInput.Serialization.cs | 135 + .../Models/UnknownAnalyzeConversationInput.cs | 28 + ...nversationOperationAction.Serialization.cs | 146 + ...knownAnalyzeConversationOperationAction.cs | 29 + ...nversationOperationResult.Serialization.cs | 162 + ...knownAnalyzeConversationOperationResult.cs | 31 + ...ionEntityExtraInformation.Serialization.cs | 135 + ...knownConversationEntityExtraInformation.cs | 28 + .../UnknownConversationInput.Serialization.cs | 166 + .../Models/UnknownConversationInput.cs | 31 + .../UnknownPredictionBase.Serialization.cs | 146 + .../Generated/Models/UnknownPredictionBase.cs | 29 + .../UnknownResolutionBase.Serialization.cs | 135 + .../Generated/Models/UnknownResolutionBase.cs | 28 + ...UnknownTargetIntentResult.Serialization.cs | 154 + .../Models/UnknownTargetIntentResult.cs | 30 + .../Models/VolumeResolution.Serialization.cs | 151 + .../src/Generated/Models/VolumeResolution.cs | 47 + .../src/Generated/Models/VolumeUnit.cs | 129 + .../Models/WeightResolution.Serialization.cs | 151 + .../src/Generated/Models/WeightResolution.cs | 47 + .../src/Generated/Models/WeightUnit.cs | 93 + .../Models/WordLevelTiming.Serialization.cs | 168 + .../src/Generated/Models/WordLevelTiming.cs | 73 + .../src/autorest.md | 282 -- .../Samples_ConversationAnalysisClient.cs | 579 +-- .../Samples_ConversationAuthoringClient.cs | 3256 ---------------- .../tsp-location.yaml | 4 + .../Azure.AI.Language.Text.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../Azure.AI.Language.AnalyzeText/README.md | 107 + .../Azure.AI.Language.Text.netstandard2.0.cs | 3332 +++++++++++++++++ .../src/Azure.AI.Language.Text.csproj | 20 + .../AILanguageTextClientBuilderExtensions.cs | 46 + .../Generated/AILanguageTextModelFactory.cs | 1700 +++++++++ .../src/Generated/Docs/TextAnalysisClient.xml | 583 +++ .../src/Generated/Internal/Argument.cs | 129 + .../Internal/ChangeTrackingDictionary.cs | 167 + .../Generated/Internal/ChangeTrackingList.cs | 153 + .../Internal/ModelSerializationExtensions.cs | 398 ++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + ...ummarizationActionContent.Serialization.cs | 216 ++ .../AbstractiveSummarizationActionContent.cs | 85 + ...marizationOperationAction.Serialization.cs | 161 + ...AbstractiveSummarizationOperationAction.cs | 35 + ...marizationOperationResult.Serialization.cs | 176 + ...AbstractiveSummarizationOperationResult.cs | 49 + ...activeSummarizationResult.Serialization.cs | 186 + .../Models/AbstractiveSummarizationResult.cs | 94 + .../AbstractiveSummary.Serialization.cs | 160 + .../Generated/Models/AbstractiveSummary.cs | 80 + ...esultWithDetectedLanguage.Serialization.cs | 207 + ...mmaryDocumentResultWithDetectedLanguage.cs | 98 + .../Models/AgeMetadata.Serialization.cs | 151 + .../src/Generated/Models/AgeMetadata.cs | 47 + .../src/Generated/Models/AgeUnit.cs | 60 + ...owOverlapEntityPolicyType.Serialization.cs | 135 + .../Models/AllowOverlapEntityPolicyType.cs | 29 + ...namicClassificationResult.Serialization.cs | 143 + .../AnalyzeTextDynamicClassificationResult.cs | 44 + ...AnalyzeTextEntitiesResult.Serialization.cs | 143 + .../Models/AnalyzeTextEntitiesResult.cs | 44 + ...zeTextEntityLinkingResult.Serialization.cs | 143 + .../Models/AnalyzeTextEntityLinkingResult.cs | 44 + .../Models/AnalyzeTextError.Serialization.cs | 200 + .../src/Generated/Models/AnalyzeTextError.cs | 94 + .../Generated/Models/AnalyzeTextErrorCode.cs | 99 + .../Models/AnalyzeTextInput.Serialization.cs | 132 + .../src/Generated/Models/AnalyzeTextInput.cs | 69 + .../Generated/Models/AnalyzeTextInputKind.cs | 66 + ...nalyzeTextKeyPhraseResult.Serialization.cs | 143 + .../Models/AnalyzeTextKeyPhraseResult.cs | 44 + ...xtLanguageDetectionResult.Serialization.cs | 143 + .../AnalyzeTextLanguageDetectionResult.cs | 44 + ...nalyzeTextOperationAction.Serialization.cs | 144 + .../Models/AnalyzeTextOperationAction.cs | 73 + .../Models/AnalyzeTextOperationActionKind.cs | 87 + ...AnalyzeTextOperationInput.Serialization.cs | 175 + .../Models/AnalyzeTextOperationInput.cs | 103 + ...nalyzeTextOperationResult.Serialization.cs | 148 + .../Models/AnalyzeTextOperationResult.cs | 90 + .../Models/AnalyzeTextOperationResultsKind.cs | 87 + ...AnalyzeTextOperationState.Serialization.cs | 258 ++ .../Models/AnalyzeTextOperationState.cs | 118 + .../AnalyzeTextPiiResult.Serialization.cs | 143 + .../Generated/Models/AnalyzeTextPiiResult.cs | 44 + .../Models/AnalyzeTextResult.Serialization.cs | 132 + .../src/Generated/Models/AnalyzeTextResult.cs | 69 + .../Models/AnalyzeTextResultsKind.cs | 66 + ...nalyzeTextSentimentResult.Serialization.cs | 143 + .../Models/AnalyzeTextSentimentResult.cs | 44 + .../Models/AreaMetadata.Serialization.cs | 151 + .../src/Generated/Models/AreaMetadata.cs | 47 + .../src/Generated/Models/AreaUnit.cs | 84 + .../Models/BaseMetadata.Serialization.cs | 142 + .../src/Generated/Models/BaseMetadata.cs | 69 + ...esultWithDetectedLanguage.Serialization.cs | 207 + ...ationDocumentResultWithDetectedLanguage.cs | 98 + .../ClassificationResult.Serialization.cs | 143 + .../Generated/Models/ClassificationResult.cs | 81 + .../Generated/Models/ClassificationType.cs | 51 + .../Models/CurrencyMetadata.Serialization.cs | 162 + .../src/Generated/Models/CurrencyMetadata.cs | 54 + ...ummarizationActionContent.Serialization.cs | 210 ++ ...omAbstractiveSummarizationActionContent.cs | 98 + ...marizationOperationAction.Serialization.cs | 154 + ...AbstractiveSummarizationOperationAction.cs | 45 + ...marizationOperationResult.Serialization.cs | 176 + ...AbstractiveSummarizationOperationResult.cs | 49 + ...activeSummarizationResult.Serialization.cs | 200 + .../CustomAbstractiveSummarizationResult.cs | 101 + ...stomEntitiesActionContent.Serialization.cs | 173 + .../Models/CustomEntitiesActionContent.cs | 90 + ...omEntitiesOperationAction.Serialization.cs | 161 + .../Models/CustomEntitiesOperationAction.cs | 35 + ...hDocumentDetectedLanguage.Serialization.cs | 200 + ...itiesResultWithDocumentDetectedLanguage.cs | 101 + ...ecognitionOperationResult.Serialization.cs | 176 + .../CustomEntityRecognitionOperationResult.cs | 49 + ...omHealthcareActionContent.Serialization.cs | 173 + .../Models/CustomHealthcareActionContent.cs | 90 + ...hDocumentDetectedLanguage.Serialization.cs | 226 ++ ...umentResultWithDocumentDetectedLanguage.cs | 105 + .../CustomHealthcareEntity.Serialization.cs | 265 ++ .../Models/CustomHealthcareEntity.cs | 129 + ...HealthcareOperationAction.Serialization.cs | 161 + .../Models/CustomHealthcareOperationAction.cs | 35 + ...HealthcareOperationResult.Serialization.cs | 176 + .../Models/CustomHealthcareOperationResult.cs | 49 + .../CustomHealthcareResult.Serialization.cs | 200 + .../Models/CustomHealthcareResult.cs | 101 + ...hDocumentDetectedLanguage.Serialization.cs | 200 + ...ationResultWithDocumentDetectedLanguage.cs | 101 + ...assificationActionContent.Serialization.cs | 158 + ...omMultiLabelClassificationActionContent.cs | 86 + ...sificationOperationAction.Serialization.cs | 161 + ...MultiLabelClassificationOperationAction.cs | 35 + ...sificationOperationResult.Serialization.cs | 176 + ...MultiLabelClassificationOperationResult.cs | 49 + .../CustomSentenceSentiment.Serialization.cs | 173 + .../Models/CustomSentenceSentiment.cs | 100 + ...mentAnalysisActionContent.Serialization.cs | 173 + .../CustomSentimentAnalysisActionContent.cs | 90 + ...ntAnalysisOperationAction.Serialization.cs | 161 + .../CustomSentimentAnalysisOperationAction.cs | 35 + ...ntAnalysisOperationResult.Serialization.cs | 176 + .../CustomSentimentAnalysisOperationResult.cs | 49 + ...omSentimentAnalysisResult.Serialization.cs | 200 + .../Models/CustomSentimentAnalysisResult.cs | 101 + ...entAnalysisResultDocument.Serialization.cs | 225 ++ .../CustomSentimentAnalysisResultDocument.cs | 111 + ...assificationActionContent.Serialization.cs | 158 + ...mSingleLabelClassificationActionContent.cs | 86 + ...sificationOperationAction.Serialization.cs | 161 + ...ingleLabelClassificationOperationAction.cs | 35 + ...sificationOperationResult.Serialization.cs | 176 + ...ingleLabelClassificationOperationResult.cs | 49 + .../Models/DateMetadata.Serialization.cs | 160 + .../src/Generated/Models/DateMetadata.cs | 35 + .../Models/DateTimeMetadata.Serialization.cs | 160 + .../src/Generated/Models/DateTimeMetadata.cs | 35 + .../Models/DateValue.Serialization.cs | 158 + .../src/Generated/Models/DateValue.cs | 86 + .../Models/DetectedLanguage.Serialization.cs | 187 + .../src/Generated/Models/DetectedLanguage.cs | 96 + .../Models/DocumentError.Serialization.cs | 143 + .../src/Generated/Models/DocumentError.cs | 82 + .../Models/DocumentSentiment.Serialization.cs | 32 + .../src/Generated/Models/DocumentSentiment.cs | 22 + .../DocumentStatistics.Serialization.cs | 143 + .../Generated/Models/DocumentStatistics.cs | 78 + .../Models/DocumentWarning.Serialization.cs | 154 + .../src/Generated/Models/DocumentWarning.cs | 85 + ...assificationActionContent.Serialization.cs | 186 + .../DynamicClassificationActionContent.cs | 88 + ...ssificationDocumentResult.Serialization.cs | 186 + .../DynamicClassificationDocumentResult.cs | 94 + ...namicClassificationResult.Serialization.cs | 186 + .../Models/DynamicClassificationResult.cs | 94 + .../EntitiesActionContent.Serialization.cs | 256 ++ .../Generated/Models/EntitiesActionContent.cs | 99 + ...esultWithDetectedLanguage.Serialization.cs | 207 + ...itiesDocumentResultWithDetectedLanguage.cs | 98 + ...hMetadataDetectedLanguage.Serialization.cs | 207 + ...umentResultWithMetadataDetectedLanguage.cs | 98 + .../EntitiesOperationAction.Serialization.cs | 161 + .../Models/EntitiesOperationAction.cs | 35 + .../Models/EntitiesResult.Serialization.cs | 186 + .../src/Generated/Models/EntitiesResult.cs | 94 + .../src/Generated/Models/EntityCategory.cs | 201 + ...ntityComponentInformation.Serialization.cs | 128 + .../Models/EntityComponentInformation.cs | 69 + .../Generated/Models/EntityComponentKind.cs | 54 + .../EntityInferenceConfig.Serialization.cs | 142 + .../Generated/Models/EntityInferenceConfig.cs | 65 + ...ntityLinkingActionContent.Serialization.cs | 168 + .../Models/EntityLinkingActionContent.cs | 73 + .../EntityLinkingMatch.Serialization.cs | 159 + .../Generated/Models/EntityLinkingMatch.cs | 93 + ...ityLinkingOperationAction.Serialization.cs | 161 + .../Models/EntityLinkingOperationAction.cs | 35 + ...ityLinkingOperationResult.Serialization.cs | 176 + .../Models/EntityLinkingOperationResult.cs | 49 + .../EntityLinkingResult.Serialization.cs | 186 + .../Generated/Models/EntityLinkingResult.cs | 94 + ...esultWithDetectedLanguage.Serialization.cs | 207 + ...EntityLinkingResultWithDetectedLanguage.cs | 98 + .../EntityOverlapPolicy.Serialization.cs | 127 + .../Generated/Models/EntityOverlapPolicy.cs | 69 + ...ecognitionOperationResult.Serialization.cs | 176 + .../EntityRecognitionOperationResult.cs | 49 + .../Models/EntityTag.Serialization.cs | 150 + .../src/Generated/Models/EntityTag.cs | 79 + ...esultWithDetectedLanguage.Serialization.cs | 207 + ...mmaryDocumentResultWithDetectedLanguage.cs | 98 + .../ExtractedSummarySentence.Serialization.cs | 159 + .../Models/ExtractedSummarySentence.cs | 93 + ...ummarizationActionContent.Serialization.cs | 216 ++ .../ExtractiveSummarizationActionContent.cs | 85 + ...marizationOperationAction.Serialization.cs | 161 + .../ExtractiveSummarizationOperationAction.cs | 35 + ...marizationOperationResult.Serialization.cs | 176 + .../ExtractiveSummarizationOperationResult.cs | 49 + ...activeSummarizationResult.Serialization.cs | 186 + .../Models/ExtractiveSummarizationResult.cs | 94 + .../ExtractiveSummarizationSortingCriteria.cs | 51 + .../Models/FhirBundle.Serialization.cs | 121 + .../src/Generated/Models/FhirBundle.cs | 61 + .../src/Generated/Models/FhirVersion.cs | 48 + .../HealthcareActionContent.Serialization.cs | 204 + .../Models/HealthcareActionContent.cs | 81 + .../HealthcareAssertion.Serialization.cs | 187 + .../Generated/Models/HealthcareAssertion.cs | 77 + ...hcareAssertionAssociation.Serialization.cs | 28 + .../Models/HealthcareAssertionAssociation.cs | 18 + ...lthcareAssertionCertainty.Serialization.cs | 34 + .../Models/HealthcareAssertionCertainty.cs | 24 + ...reAssertionConditionality.Serialization.cs | 28 + .../HealthcareAssertionConditionality.cs | 18 + ...hcareAssertionTemporality.Serialization.cs | 30 + .../Models/HealthcareAssertionTemporality.cs | 20 + .../Models/HealthcareDocumentType.cs | 72 + ...hDocumentDetectedLanguage.Serialization.cs | 242 ++ ...umentResultWithDocumentDetectedLanguage.cs | 109 + .../Models/HealthcareEntity.Serialization.cs | 239 ++ .../src/Generated/Models/HealthcareEntity.cs | 116 + .../Models/HealthcareEntityCategory.cs | 153 + .../HealthcareEntityLink.Serialization.cs | 143 + .../Generated/Models/HealthcareEntityLink.cs | 82 + ...HealthcareOperationAction.Serialization.cs | 161 + .../Models/HealthcareOperationAction.cs | 35 + ...HealthcareOperationResult.Serialization.cs | 176 + .../Models/HealthcareOperationResult.cs | 49 + .../HealthcareRelation.Serialization.cs | 168 + .../Generated/Models/HealthcareRelation.cs | 86 + .../HealthcareRelationEntity.Serialization.cs | 143 + .../Models/HealthcareRelationEntity.cs | 82 + .../Models/HealthcareResult.Serialization.cs | 186 + .../src/Generated/Models/HealthcareResult.cs | 94 + .../InformationMetadata.Serialization.cs | 151 + .../Generated/Models/InformationMetadata.cs | 47 + .../src/Generated/Models/InformationUnit.cs | 84 + .../src/Generated/Models/InnerErrorCode.cs | 87 + .../Models/InnerErrorModel.Serialization.cs | 201 + .../src/Generated/Models/InnerErrorModel.cs | 94 + .../KeyPhraseActionContent.Serialization.cs | 153 + .../Models/KeyPhraseActionContent.cs | 69 + ...ExtractionOperationResult.Serialization.cs | 176 + .../KeyPhraseExtractionOperationResult.cs | 49 + .../KeyPhraseOperationAction.Serialization.cs | 161 + .../Models/KeyPhraseOperationAction.cs | 35 + .../Models/KeyPhraseResult.Serialization.cs | 186 + .../src/Generated/Models/KeyPhraseResult.cs | 94 + ...esultWithDetectedLanguage.Serialization.cs | 207 + ...rasesDocumentResultWithDetectedLanguage.cs | 98 + ...ageDetectionActionContent.Serialization.cs | 153 + .../Models/LanguageDetectionActionContent.cs | 69 + ...geDetectionDocumentResult.Serialization.cs | 176 + .../Models/LanguageDetectionDocumentResult.cs | 94 + .../LanguageDetectionResult.Serialization.cs | 186 + .../Models/LanguageDetectionResult.cs | 94 + ...anguageDetectionTextInput.Serialization.cs | 152 + .../Models/LanguageDetectionTextInput.cs | 66 + .../Models/LanguageInput.Serialization.cs | 154 + .../src/Generated/Models/LanguageInput.cs | 86 + .../Models/LearnedComponent.Serialization.cs | 146 + .../src/Generated/Models/LearnedComponent.cs | 34 + .../Models/LengthMetadata.Serialization.cs | 151 + .../src/Generated/Models/LengthMetadata.cs | 47 + .../src/Generated/Models/LengthUnit.cs | 96 + .../Models/LinkedEntity.Serialization.cs | 207 + .../src/Generated/Models/LinkedEntity.cs | 112 + .../Models/ListComponent.Serialization.cs | 146 + .../src/Generated/Models/ListComponent.cs | 34 + ...chLongestEntityPolicyType.Serialization.cs | 135 + .../Models/MatchLongestEntityPolicyType.cs | 29 + .../src/Generated/Models/MetadataKind.cs | 96 + .../MultiLanguageInput.Serialization.cs | 154 + .../Generated/Models/MultiLanguageInput.cs | 86 + .../MultiLanguageTextInput.Serialization.cs | 152 + .../Models/MultiLanguageTextInput.cs | 66 + .../Models/NamedEntity.Serialization.cs | 185 + .../src/Generated/Models/NamedEntity.cs | 104 + .../NamedEntityWithMetadata.Serialization.cs | 229 ++ .../Models/NamedEntityWithMetadata.cs | 131 + .../src/Generated/Models/NumberKind.cs | 63 + .../Models/NumberMetadata.Serialization.cs | 151 + .../src/Generated/Models/NumberMetadata.cs | 47 + .../NumericRangeMetadata.Serialization.cs | 180 + .../Generated/Models/NumericRangeMetadata.cs | 57 + .../Models/OrdinalMetadata.Serialization.cs | 159 + .../src/Generated/Models/OrdinalMetadata.cs | 57 + .../Models/PiiActionContent.Serialization.cs | 256 ++ .../src/Generated/Models/PiiActionContent.cs | 91 + .../Generated/Models/PiiCategoriesExclude.cs | 558 +++ .../src/Generated/Models/PiiCategory.cs | 564 +++ .../src/Generated/Models/PiiDomain.cs | 51 + ...ecognitionOperationResult.Serialization.cs | 176 + .../PiiEntityRecognitionOperationResult.cs | 49 + .../PiiOperationAction.Serialization.cs | 161 + .../Generated/Models/PiiOperationAction.cs | 35 + .../Models/PiiResult.Serialization.cs | 186 + .../src/Generated/Models/PiiResult.cs | 94 + ...esultWithDetectedLanguage.Serialization.cs | 216 ++ .../Models/PiiResultWithDetectedLanguage.cs | 105 + .../src/Generated/Models/PolicyKind.cs | 51 + .../Models/PrebuiltComponent.Serialization.cs | 146 + .../src/Generated/Models/PrebuiltComponent.cs | 34 + .../src/Generated/Models/RangeInclusivity.cs | 57 + .../src/Generated/Models/RangeKind.cs | 75 + .../Generated/Models/RedactionCharacter.cs | 87 + .../src/Generated/Models/RelationType.cs | 150 + .../src/Generated/Models/RelativeTo.cs | 54 + .../Models/RequestStatistics.Serialization.cs | 159 + .../src/Generated/Models/RequestStatistics.cs | 90 + .../src/Generated/Models/ScriptCode.cs | 132 + .../src/Generated/Models/ScriptKind.cs | 132 + .../SentenceAssessment.Serialization.cs | 182 + .../Generated/Models/SentenceAssessment.cs | 106 + .../Models/SentenceSentiment.Serialization.cs | 225 ++ .../src/Generated/Models/SentenceSentiment.cs | 110 + .../SentenceSentimentValue.Serialization.cs | 30 + .../Models/SentenceSentimentValue.cs | 20 + .../Models/SentenceTarget.Serialization.cs | 192 + .../src/Generated/Models/SentenceTarget.cs | 108 + ...mentAnalysisActionContent.Serialization.cs | 183 + .../Models/SentimentAnalysisActionContent.cs | 77 + ...ntAnalysisOperationAction.Serialization.cs | 161 + .../SentimentAnalysisOperationAction.cs | 35 + ...SentimentConfidenceScores.Serialization.cs | 151 + .../Models/SentimentConfidenceScores.cs | 84 + ...esultWithDetectedLanguage.Serialization.cs | 225 ++ ...imentDocumentResultWithDetectedLanguage.cs | 111 + .../SentimentOperationResult.Serialization.cs | 176 + .../Models/SentimentOperationResult.cs | 49 + .../Models/SentimentResult.Serialization.cs | 186 + .../src/Generated/Models/SentimentResult.cs | 94 + .../Models/SpeedMetadata.Serialization.cs | 151 + .../src/Generated/Models/SpeedMetadata.cs | 47 + .../src/Generated/Models/SpeedUnit.cs | 87 + .../src/Generated/Models/StringIndexType.cs | 54 + .../Models/SummaryContext.Serialization.cs | 143 + .../src/Generated/Models/SummaryContext.cs | 78 + .../Generated/Models/SummaryLengthBucket.cs | 54 + ...argetConfidenceScoreLabel.Serialization.cs | 143 + .../Models/TargetConfidenceScoreLabel.cs | 78 + .../Models/TargetRelation.Serialization.cs | 143 + .../src/Generated/Models/TargetRelation.cs | 81 + .../TargetRelationType.Serialization.cs | 28 + .../Generated/Models/TargetRelationType.cs | 18 + .../TemperatureMetadata.Serialization.cs | 151 + .../Generated/Models/TemperatureMetadata.cs | 47 + .../src/Generated/Models/TemperatureUnit.cs | 60 + .../src/Generated/Models/TemporalModifier.cs | 99 + .../TemporalSetMetadata.Serialization.cs | 160 + .../Generated/Models/TemporalSetMetadata.cs | 35 + .../TemporalSpanMetadata.Serialization.cs | 160 + .../Generated/Models/TemporalSpanMetadata.cs | 35 + .../TemporalSpanValues.Serialization.cs | 192 + .../Generated/Models/TemporalSpanValues.cs | 81 + .../src/Generated/Models/TextActionState.cs | 66 + .../Models/TextActions.Serialization.cs | 190 + .../src/Generated/Models/TextActions.cs | 103 + ...ynamicClassificationInput.Serialization.cs | 165 + .../Models/TextDynamicClassificationInput.cs | 38 + .../TextEntityLinkingInput.Serialization.cs | 165 + .../Models/TextEntityLinkingInput.cs | 38 + ...extEntityRecognitionInput.Serialization.cs | 165 + .../Models/TextEntityRecognitionInput.cs | 38 + ...tKeyPhraseExtractionInput.Serialization.cs | 165 + .../Models/TextKeyPhraseExtractionInput.cs | 38 + ...extLanguageDetectionInput.Serialization.cs | 165 + .../Models/TextLanguageDetectionInput.cs | 38 + ...iEntitiesRecognitionInput.Serialization.cs | 165 + .../Models/TextPiiEntitiesRecognitionInput.cs | 38 + ...extSentimentAnalysisInput.Serialization.cs | 165 + .../Models/TextSentimentAnalysisInput.cs | 38 + .../Models/TimeMetadata.Serialization.cs | 160 + .../src/Generated/Models/TimeMetadata.cs | 35 + .../Models/TokenSentiment.Serialization.cs | 30 + .../src/Generated/Models/TokenSentiment.cs | 20 + .../UnknownAnalyzeTextInput.Serialization.cs | 135 + .../Models/UnknownAnalyzeTextInput.cs | 28 + ...nalyzeTextOperationAction.Serialization.cs | 146 + .../UnknownAnalyzeTextOperationAction.cs | 29 + ...nalyzeTextOperationResult.Serialization.cs | 162 + .../UnknownAnalyzeTextOperationResult.cs | 31 + .../UnknownAnalyzeTextResult.Serialization.cs | 135 + .../Models/UnknownAnalyzeTextResult.cs | 28 + .../UnknownBaseMetadata.Serialization.cs | 135 + .../Generated/Models/UnknownBaseMetadata.cs | 28 + ...ntityComponentInformation.Serialization.cs | 135 + .../UnknownEntityComponentInformation.cs | 28 + ...nknownEntityOverlapPolicy.Serialization.cs | 135 + .../Models/UnknownEntityOverlapPolicy.cs | 28 + .../Models/VolumeMetadata.Serialization.cs | 151 + .../src/Generated/Models/VolumeMetadata.cs | 47 + .../src/Generated/Models/VolumeUnit.cs | 129 + .../src/Generated/Models/WarningCode.cs | 51 + .../Models/WeightMetadata.Serialization.cs | 151 + .../src/Generated/Models/WeightMetadata.cs | 47 + .../src/Generated/Models/WeightUnit.cs | 93 + .../src/Generated/TextAnalysisClient.cs | 597 +++ .../Generated/TextAnalysisClientOptions.cs | 43 + .../src/Properties/AssemblyInfo.cs | 11 + .../tests/Azure.AI.Language.Text.Tests.csproj | 20 + .../Samples/Samples_TextAnalysisClient.cs | 640 ++++ .../tsp-location.yaml | 4 + ...extAnalysisAnalyzeTextCancelJobHeaders.cs} | 8 +- ...extAnalysisAnalyzeTextSubmitJobHeaders.cs} | 8 +- ...veLanguageServiceTextAnalysisRestClient.cs | 149 +- ...iveSummarizationLROResult.Serialization.cs | 52 +- .../AbstractiveSummarizationLROResult.cs | 24 +- ...ctiveSummarizationLROTask.Serialization.cs | 49 +- .../Models/AbstractiveSummarizationLROTask.cs | 17 +- ...activeSummarizationResult.Serialization.cs | 46 +- .../Models/AbstractiveSummarizationResult.cs | 26 +- ...veSummarizationResultBase.Serialization.cs | 68 - .../AbstractiveSummarizationResultBase.cs | 37 - ...mmarizationTaskParameters.Serialization.cs | 68 +- .../AbstractiveSummarizationTaskParameters.cs | 28 +- ...izationTaskParametersBase.Serialization.cs | 79 - ...tractiveSummarizationTaskParametersBase.cs | 32 - ...tiveSummaryDocumentResult.Serialization.cs | 64 +- .../AbstractiveSummaryDocumentResult.cs | 21 +- ...bstractiveSummaryInternal.Serialization.cs | 31 +- .../Models/AbstractiveSummaryInternal.cs | 8 +- .../Models/AnalyzeTextEntityLinkingInput.cs | 12 +- .../AnalyzeTextEntityRecognitionInput.cs | 12 +- .../AnalyzeTextJobState.Serialization.cs | 38 +- .../Generated/Models/AnalyzeTextJobState.cs | 72 +- .../AnalyzeTextJobStatistics.Serialization.cs | 44 - .../Models/AnalyzeTextJobStatistics.cs | 28 - .../Generated/Models/AnalyzeTextJobsInput.cs | 18 +- .../AnalyzeTextKeyPhraseExtractionInput.cs | 12 +- .../AnalyzeTextLROResult.Serialization.cs | 30 +- .../Generated/Models/AnalyzeTextLROResult.cs | 36 +- .../Models/AnalyzeTextLROResultsKind.cs | 28 +- .../AnalyzeTextLROTask.Serialization.cs | 40 +- .../Generated/Models/AnalyzeTextLROTask.cs | 15 +- .../Models/AnalyzeTextLROTaskKind.cs | 28 +- .../AnalyzeTextLanguageDetectionInput.cs | 12 +- .../AnalyzeTextPiiEntitiesRecognitionInput.cs | 12 +- .../AnalyzeTextSentimentAnalysisInput.cs | 12 +- .../src/Generated/Models/AnalyzeTextTask.cs | 6 +- .../Generated/Models/AnalyzeTextTaskKind.cs | 14 +- .../Generated/Models/AnalyzeTextTaskResult.cs | 6 +- .../Models/AnalyzeTextTaskResultsKind.cs | 14 +- ...ssificationDocumentResult.Serialization.cs | 64 +- .../Models/ClassificationDocumentResult.cs | 27 +- .../ClassificationResult.Serialization.cs | 21 +- .../Generated/Models/ClassificationResult.cs | 8 +- .../CustomEntitiesLROTask.Serialization.cs | 46 +- .../Generated/Models/CustomEntitiesLROTask.cs | 10 +- .../CustomEntitiesResult.Serialization.cs | 66 +- .../Generated/Models/CustomEntitiesResult.cs | 31 +- ...titiesResultDocumentsItem.Serialization.cs | 109 - .../CustomEntitiesResultDocumentsItem.cs | 37 - ...tomEntitiesTaskParameters.Serialization.cs | 66 +- .../Models/CustomEntitiesTaskParameters.cs | 24 +- ...ntityRecognitionLROResult.Serialization.cs | 52 +- .../CustomEntityRecognitionLROResult.cs | 26 +- ...LabelClassificationResult.Serialization.cs | 66 +- .../Models/CustomLabelClassificationResult.cs | 25 +- ...cationResultDocumentsItem.Serialization.cs | 109 - ...mLabelClassificationResultDocumentsItem.cs | 37 - ...elClassificationLROResult.Serialization.cs | 52 +- ...CustomMultiLabelClassificationLROResult.cs | 26 +- ...abelClassificationLROTask.Serialization.cs | 46 +- .../CustomMultiLabelClassificationLROTask.cs | 8 +- ...ssificationTaskParameters.Serialization.cs | 52 +- ...mMultiLabelClassificationTaskParameters.cs | 21 +- .../Models/CustomResult.Serialization.cs | 99 - .../src/Generated/Models/CustomResult.cs | 55 - ...elClassificationLROResult.Serialization.cs | 52 +- ...ustomSingleLabelClassificationLROResult.cs | 26 +- ...abelClassificationLROTask.Serialization.cs | 46 +- .../CustomSingleLabelClassificationLROTask.cs | 8 +- ...ssificationTaskParameters.Serialization.cs | 52 +- ...SingleLabelClassificationTaskParameters.cs | 21 +- .../CustomTaskParameters.Serialization.cs | 80 - .../Generated/Models/CustomTaskParameters.cs | 43 - .../DetectedLanguageInternal.Serialization.cs | 37 +- .../Models/DetectedLanguageInternal.cs | 4 +- .../Models/DocumentError.Serialization.cs | 21 +- .../src/Generated/Models/DocumentError.cs | 6 +- .../Models/DocumentResult.Serialization.cs | 91 - .../src/Generated/Models/DocumentResult.cs | 48 - .../Models/DocumentWarning.Serialization.cs | 26 +- .../src/Generated/Models/DocumentWarning.cs | 16 +- .../EntitiesDocumentResult.Serialization.cs | 64 +- .../Models/EntitiesDocumentResult.cs | 21 +- .../Models/EntitiesLROTask.Serialization.cs | 46 +- .../src/Generated/Models/EntitiesLROTask.cs | 8 +- .../Models/EntitiesResult.Serialization.cs | 64 +- .../src/Generated/Models/EntitiesResult.cs | 21 +- ...titiesResultDocumentsItem.Serialization.cs | 109 - .../Models/EntitiesResultDocumentsItem.cs | 37 - .../EntitiesTaskParameters.Serialization.cs | 60 +- .../Models/EntitiesTaskParameters.cs | 18 +- .../Generated/Models/EntitiesTaskResult.cs | 10 +- .../Generated/Models/Entity.Serialization.cs | 32 +- .../src/Generated/Models/Entity.cs | 16 +- .../Models/EntityDataSource.Serialization.cs | 21 +- .../src/Generated/Models/EntityDataSource.cs | 2 +- .../EntityLinkingLROResult.Serialization.cs | 52 +- .../Models/EntityLinkingLROResult.cs | 26 +- .../EntityLinkingLROTask.Serialization.cs | 46 +- .../Generated/Models/EntityLinkingLROTask.cs | 10 +- .../EntityLinkingResult.Serialization.cs | 64 +- .../Generated/Models/EntityLinkingResult.cs | 21 +- ...inkingResultDocumentsItem.Serialization.cs | 109 - .../EntityLinkingResultDocumentsItem.cs | 37 - ...tityLinkingTaskParameters.Serialization.cs | 60 +- .../Models/EntityLinkingTaskParameters.cs | 18 +- .../Models/EntityLinkingTaskResult.cs | 10 +- ...ntityRecognitionLROResult.Serialization.cs | 52 +- .../Models/EntityRecognitionLROResult.cs | 26 +- .../Generated/Models/Error.Serialization.cs | 60 +- .../src/Generated/Models/Error.cs | 21 +- .../src/Generated/Models/ErrorCode.cs | 36 +- ...ctedSummaryDocumentResult.Serialization.cs | 64 +- .../Models/ExtractedSummaryDocumentResult.cs | 27 +- .../ExtractedSummarySentence.Serialization.cs | 25 +- .../Models/ExtractedSummarySentence.cs | 12 +- ...iveSummarizationLROResult.Serialization.cs | 52 +- .../ExtractiveSummarizationLROResult.cs | 26 +- ...ctiveSummarizationLROTask.Serialization.cs | 46 +- .../Models/ExtractiveSummarizationLROTask.cs | 8 +- ...activeSummarizationResult.Serialization.cs | 64 +- .../Models/ExtractiveSummarizationResult.cs | 21 +- ...mmarizationTaskParameters.Serialization.cs | 88 +- .../ExtractiveSummarizationTaskParameters.cs | 28 +- .../Models/ExtractiveSummarySentencesOrder.cs | 2 +- ...areEntitiesDocumentResult.Serialization.cs | 93 +- .../HealthcareEntitiesDocumentResult.cs | 23 +- ...HealthcareEntityAssertion.Serialization.cs | 32 +- .../Models/HealthcareEntityAssertion.cs | 2 +- .../Models/HealthcareEntityCategory.cs | 70 +- .../HealthcareEntityInternal.Serialization.cs | 54 +- .../Models/HealthcareEntityInternal.cs | 28 +- .../Models/HealthcareEntityRelationType.cs | 120 +- .../HealthcareLROResult.Serialization.cs | 52 +- .../Generated/Models/HealthcareLROResult.cs | 26 +- .../Models/HealthcareLROTask.Serialization.cs | 46 +- .../src/Generated/Models/HealthcareLROTask.cs | 10 +- .../HealthcareRelationEntity.Serialization.cs | 21 +- .../Models/HealthcareRelationEntity.cs | 8 +- ...ealthcareRelationInternal.Serialization.cs | 53 +- .../Models/HealthcareRelationInternal.cs | 16 +- .../Models/HealthcareResult.Serialization.cs | 64 +- .../src/Generated/Models/HealthcareResult.cs | 27 +- ...thcareResultDocumentsItem.Serialization.cs | 127 - .../Models/HealthcareResultDocumentsItem.cs | 40 - .../HealthcareTaskParameters.Serialization.cs | 60 +- .../Models/HealthcareTaskParameters.cs | 18 +- .../src/Generated/Models/InnerErrorCode.cs | 28 +- .../Models/InnerErrorModel.Serialization.cs | 44 +- .../src/Generated/Models/InnerErrorModel.cs | 14 +- .../src/Generated/Models/JobErrors.cs | 31 - .../Models/JobState.Serialization.cs | 105 - .../src/Generated/Models/JobState.cs | 71 - ...PhraseExtractionLROResult.Serialization.cs | 52 +- .../Models/KeyPhraseExtractionLROResult.cs | 26 +- .../Models/KeyPhraseLROTask.Serialization.cs | 46 +- .../src/Generated/Models/KeyPhraseLROTask.cs | 8 +- .../Models/KeyPhraseResult.Serialization.cs | 64 +- .../src/Generated/Models/KeyPhraseResult.cs | 21 +- ...PhraseResultDocumentsItem.Serialization.cs | 109 - .../Models/KeyPhraseResultDocumentsItem.cs | 37 - .../KeyPhraseTaskParameters.Serialization.cs | 46 +- .../Models/KeyPhraseTaskParameters.cs | 15 +- .../Generated/Models/KeyPhraseTaskResult.cs | 10 +- .../KeyPhrasesDocumentResult.Serialization.cs | 64 +- .../Models/KeyPhrasesDocumentResult.cs | 21 +- .../Models/LanguageDetectionAnalysisInput.cs | 6 +- ...geDetectionDocumentResult.Serialization.cs | 49 +- .../Models/LanguageDetectionDocumentResult.cs | 22 +- .../LanguageDetectionResult.Serialization.cs | 64 +- .../Models/LanguageDetectionResult.cs | 27 +- ...geDetectionTaskParameters.Serialization.cs | 46 +- .../Models/LanguageDetectionTaskParameters.cs | 15 +- .../Models/LanguageDetectionTaskResult.cs | 10 +- .../src/Generated/Models/LanguageInput.cs | 18 +- ...kedEntitiesDocumentResult.Serialization.cs | 64 +- .../Models/LinkedEntitiesDocumentResult.cs | 21 +- .../Models/LinkedEntity.Serialization.cs | 42 +- .../src/Generated/Models/LinkedEntity.cs | 2 +- .../Models/LinkedEntityMatch.Serialization.cs | 25 +- .../src/Generated/Models/LinkedEntityMatch.cs | 2 +- .../Models/MultiLanguageAnalysisInput.cs | 6 +- .../Generated/Models/MultiLanguageInput.cs | 4 +- .../src/Generated/Models/Pagination.cs | 28 - .../src/Generated/Models/PiiDomain.cs | 2 +- ...PiiEntitiesDocumentResult.Serialization.cs | 78 +- .../Models/PiiEntitiesDocumentResult.cs | 23 +- .../Models/PiiEntitiesResult.Serialization.cs | 64 +- .../src/Generated/Models/PiiEntitiesResult.cs | 21 +- .../src/Generated/Models/PiiEntityCategory.cs | 334 +- ...ntityRecognitionLROResult.Serialization.cs | 52 +- .../Models/PiiEntityRecognitionLROResult.cs | 26 +- .../Models/PiiLROTask.Serialization.cs | 46 +- .../src/Generated/Models/PiiLROTask.cs | 10 +- .../PiiResultDocumentsItem.Serialization.cs | 117 - .../Models/PiiResultDocumentsItem.cs | 40 - .../Models/PiiTaskParameters.Serialization.cs | 94 +- .../src/Generated/Models/PiiTaskParameters.cs | 24 +- .../src/Generated/Models/PiiTaskResult.cs | 10 +- .../Models/PreBuiltResult.Serialization.cs | 91 - .../src/Generated/Models/PreBuiltResult.cs | 48 - .../PreBuiltTaskParameters.Serialization.cs | 75 - .../Models/PreBuiltTaskParameters.cs | 29 - .../SentenceAssessment.Serialization.cs | 29 +- .../Generated/Models/SentenceAssessment.cs | 32 +- ...SentenceSentimentInternal.Serialization.cs | 47 +- .../Models/SentenceSentimentInternal.cs | 12 +- .../Models/SentenceTarget.Serialization.cs | 36 +- .../src/Generated/Models/SentenceTarget.cs | 26 +- .../SentimentAnalysisLROTask.Serialization.cs | 46 +- .../Models/SentimentAnalysisLROTask.cs | 8 +- ...entAnalysisTaskParameters.Serialization.cs | 78 +- .../Models/SentimentAnalysisTaskParameters.cs | 22 +- ...SentimentConfidenceScores.Serialization.cs | 25 +- .../Models/SentimentConfidenceScores.cs | 21 +- .../SentimentDocumentResult.Serialization.cs | 92 +- .../Models/SentimentDocumentResult.cs | 37 +- .../SentimentLROResult.Serialization.cs | 52 +- .../Generated/Models/SentimentLROResult.cs | 26 +- .../Models/SentimentResponse.Serialization.cs | 64 +- .../src/Generated/Models/SentimentResponse.cs | 27 +- ...mentResponseDocumentsItem.Serialization.cs | 131 - .../Models/SentimentResponseDocumentsItem.cs | 42 - .../Generated/Models/SentimentTaskResult.cs | 10 +- .../src/Generated/Models/StringIndexType.cs | 2 +- .../SummaryContextInternal.Serialization.cs | 21 +- .../Models/SummaryContextInternal.cs | 6 +- ...argetConfidenceScoreLabel.Serialization.cs | 21 +- .../Models/TargetConfidenceScoreLabel.cs | 6 +- .../Models/TargetRelation.Serialization.cs | 33 +- .../src/Generated/Models/TargetRelation.cs | 14 +- .../Models/TaskIdentifier.Serialization.cs | 60 - .../src/Generated/Models/TaskIdentifier.cs | 28 - .../Models/TaskParameters.Serialization.cs | 64 - .../src/Generated/Models/TaskParameters.cs | 28 - .../Models/TaskState.Serialization.cs | 66 - .../src/Generated/Models/TaskState.cs | 29 - ...erialization.cs => Tasks.Serialization.cs} | 10 +- .../Models/{AnalyzeTasks.cs => Tasks.cs} | 39 +- .../Models/TasksState.Serialization.cs | 40 - .../src/Generated/Models/TasksState.cs | 28 - .../Models/TextAnalyticsOperationStatus.cs | 20 +- ...xtDocumentBatchStatistics.Serialization.cs | 25 +- .../TextDocumentStatistics.Serialization.cs | 21 +- ...knownAnalyzeTextLROResult.Serialization.cs | 50 +- .../Models/UnknownAnalyzeTextLROResult.cs | 10 +- ...UnknownAnalyzeTextLROTask.Serialization.cs | 68 - .../Models/UnknownAnalyzeTextLROTask.cs | 21 - .../Models/UnknownAnalyzeTextTaskResult.cs | 2 +- .../Generated/TextAnalyticsModelFactory.cs | 3 + .../Azure.AI.TextAnalytics/src/autorest.md | 2 +- 920 files changed, 84440 insertions(+), 17482 deletions(-) create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/AILanguageConversationsModelFactory.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientOptions.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAuthoringClient.xml create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/Optional.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationActionKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResultsKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationState.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationState.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswerSpan.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswerSpan.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionState.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActions.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationAnalysisInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationAnalysisInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationDomain.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntity.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntity.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationErrorCode.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiItemResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiItemResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeSubKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ExtraInformationKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorCode.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorModel.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorModel.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputModality.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputWarning.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputWarning.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ItemizedSummaryContext.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ItemizedSummaryContext.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LogicalOperationKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisCallingConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisCallingConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ParticipantRole.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QueryFilters.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QueryFilters.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RangeKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RankerKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactedTranscriptContent.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactedTranscriptContent.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionCharacter.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RelativeTo.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RequestStatistics.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RequestStatistics.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionBase.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionBase.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ShortAnswerConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ShortAnswerConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/StringIndexType.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationAction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationAction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryAspect.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryLengthBucket.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetProjectKind.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalModifier.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptContentType.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversation.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversation.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightUnit.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.Serialization.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.cs delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md delete mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAuthoringClient.cs create mode 100644 sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextErrorCode.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInputKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationActionKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResultsKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResultsKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityCategory.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationSortingCriteria.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirVersion.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareDocumentType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityCategory.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorCode.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MetadataKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategoriesExclude.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategory.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiDomain.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PolicyKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeInclusivity.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RedactionCharacter.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelationType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelativeTo.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptCode.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptKind.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/StringIndexType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryLengthBucket.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalModifier.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActionState.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WarningCode.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.Serialization.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightUnit.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs create mode 100644 sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml rename sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/{MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders.cs => MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders.cs} (59%) rename sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/{MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs => MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders.cs} (59%) delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationResultBase.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AbstractiveSummarizationTaskParametersBase.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/AnalyzeTextJobStatistics.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomEntitiesResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomLabelClassificationResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomResult.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/CustomTaskParameters.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/DocumentResult.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntitiesResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/EntityLinkingResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/HealthcareResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobErrors.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/JobState.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/KeyPhraseResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/Pagination.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PiiResultDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltResult.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/PreBuiltTaskParameters.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/SentimentResponseDocumentsItem.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskIdentifier.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskParameters.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TaskState.cs rename sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/{AnalyzeTasks.Serialization.cs => Tasks.Serialization.cs} (85%) rename sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/{AnalyzeTasks.cs => Tasks.cs} (64%) delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/TasksState.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.Serialization.cs delete mode 100644 sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/Models/UnknownAnalyzeTextLROTask.cs diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/AILanguageConversationsModelFactory.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/AILanguageConversationsModelFactory.cs new file mode 100644 index 0000000000000..7604a4bfbdab3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/AILanguageConversationsModelFactory.cs @@ -0,0 +1,950 @@ +// 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.Conversations.Models +{ + /// Model factory for models. + public static partial class AILanguageConversationsModelFactory + { + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// The override language of a conversation item in BCP 47 language representation. + /// Enumeration of supported conversational modalities. + /// Role of the participant. + /// The text input. + /// A new instance for mocking. + public static TextConversationItem TextConversationItem(string id = null, string participantId = null, string language = null, InputModality? modality = null, ParticipantRole? role = null, string text = null) + { + return new TextConversationItem( + id, + participantId, + language, + modality, + role, + text, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Represents a conversation analysis response. + /// A new instance for mocking. + public static ConversationActionResult ConversationActionResult(AnalyzeConversationResult result = null) + { + return new ConversationActionResult(AnalyzeConversationResultKind.ConversationResult, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// The conversation utterance given by the caller. + /// The system detected language for the query in BCP 47 language representation.. + /// + /// The prediction result of a conversation project. + /// 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 AnalyzeConversationResult AnalyzeConversationResult(string query = null, string detectedLanguage = null, PredictionBase prediction = null) + { + return new AnalyzeConversationResult(query, detectedLanguage, prediction, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of the project. + /// The intent with the highest score. + /// A new instance for mocking. + public static PredictionBase PredictionBase(string projectKind = null, string topIntent = null) + { + return new UnknownPredictionBase(projectKind == null ? default : new ProjectKind(projectKind), topIntent, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The intent with the highest score. + /// The intent classification results. + /// The entity extraction results. + /// A new instance for mocking. + public static ConversationPrediction ConversationPrediction(string topIntent = null, IEnumerable intents = null, IEnumerable entities = null) + { + intents ??= new List(); + entities ??= new List(); + + return new ConversationPrediction(ProjectKind.Conversation, topIntent, serializedAdditionalRawData: null, intents?.ToList(), entities?.ToList()); + } + + /// Initializes a new instance of . + /// A predicted class. + /// The confidence score of the class from 0.0 to 1.0. + /// A new instance for mocking. + public static ConversationIntent ConversationIntent(string category = null, float confidence = default) + { + return new ConversationIntent(category, confidence, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The entity category. + /// The predicted entity text. + /// The starting index of this entity in the query. + /// The length of the text. + /// The entity confidence score. + /// + /// The collection of entity resolution objects. + /// 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 . + /// + /// + /// The collection of entity extra information objects. + /// 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 ConversationEntity ConversationEntity(string category = null, string text = null, int offset = default, int length = default, float confidence = default, IEnumerable resolutions = null, IEnumerable extraInformation = null) + { + resolutions ??= new List(); + extraInformation ??= new List(); + + return new ConversationEntity( + category, + text, + offset, + length, + confidence, + resolutions?.ToList(), + extraInformation?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The Age Unit of measurement. + /// A new instance for mocking. + public static AgeResolution AgeResolution(double value = default, AgeUnit unit = default) + { + return new AgeResolution(ResolutionKind.AgeResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The Volume Unit of measurement. + /// A new instance for mocking. + public static VolumeResolution VolumeResolution(double value = default, VolumeUnit unit = default) + { + return new VolumeResolution(ResolutionKind.VolumeResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The speed Unit of measurement. + /// A new instance for mocking. + public static SpeedResolution SpeedResolution(double value = default, SpeedUnit unit = default) + { + return new SpeedResolution(ResolutionKind.SpeedResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The area Unit of measurement. + /// A new instance for mocking. + public static AreaResolution AreaResolution(double value = default, AreaUnit unit = default) + { + return new AreaResolution(ResolutionKind.AreaResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The length Unit of measurement. + /// A new instance for mocking. + public static LengthResolution LengthResolution(double value = default, LengthUnit unit = default) + { + return new LengthResolution(ResolutionKind.LengthResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The information (data) Unit of measurement. + /// A new instance for mocking. + public static InformationResolution InformationResolution(double value = default, InformationUnit unit = default) + { + return new InformationResolution(ResolutionKind.InformationResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The temperature Unit of measurement. + /// A new instance for mocking. + public static TemperatureResolution TemperatureResolution(double value = default, TemperatureUnit unit = default) + { + return new TemperatureResolution(ResolutionKind.TemperatureResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The weight Unit of measurement. + /// A new instance for mocking. + public static WeightResolution WeightResolution(double value = default, WeightUnit unit = default) + { + return new WeightResolution(ResolutionKind.WeightResolution, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + /// The money amount captured in the extracted entity. + /// The unit of the amount captured in the extracted entity. + /// A new instance for mocking. + public static CurrencyResolution CurrencyResolution(string iso4217 = null, double value = default, string unit = null) + { + return new CurrencyResolution(ResolutionKind.CurrencyResolution, serializedAdditionalRawData: null, iso4217, value, unit); + } + + /// Initializes a new instance of . + /// A resolution for boolean expressions. + /// A new instance for mocking. + public static BooleanResolution BooleanResolution(bool value = default) + { + return new BooleanResolution(ResolutionKind.BooleanResolution, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The DateTime SubKind. + /// The actual time that the extracted text denote. + /// An optional modifier of a date/time instance. + /// A new instance for mocking. + public static DateTimeResolution DateTimeResolution(string timex = null, DateTimeSubKind dateTimeSubKind = default, string value = null, TemporalModifier? modifier = null) + { + return new DateTimeResolution( + ResolutionKind.DateTimeResolution, + serializedAdditionalRawData: null, + timex, + dateTimeSubKind, + value, + modifier); + } + + /// Initializes a new instance of . + /// The type of the extracted number entity. + /// A numeric representation of what the extracted text denotes. + /// A new instance for mocking. + public static NumberResolution NumberResolution(NumberKind numberKind = default, double value = default) + { + return new NumberResolution(ResolutionKind.NumberResolution, serializedAdditionalRawData: null, numberKind, value); + } + + /// Initializes a new instance of . + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + /// A new instance for mocking. + public static OrdinalResolution OrdinalResolution(string offset = null, RelativeTo relativeTo = default, string value = null) + { + return new OrdinalResolution(ResolutionKind.OrdinalResolution, serializedAdditionalRawData: null, offset, relativeTo, value); + } + + /// Initializes a new instance of . + /// represents the resolution of a date and/or time span. An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// represents the resolution of a date and/or time span. An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + /// An optional modifier of a date/time instance. + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + /// A new instance for mocking. + public static TemporalSpanResolution TemporalSpanResolution(string begin = null, string end = null, string duration = null, TemporalModifier? modifier = null, string timex = null) + { + return new TemporalSpanResolution( + ResolutionKind.TemporalSpanResolution, + serializedAdditionalRawData: null, + begin, + end, + duration, + modifier, + timex); + } + + /// Initializes a new instance of . + /// The kind of range that the resolution object represents. + /// The beginning value of the interval. + /// The ending value of the interval. + /// A new instance for mocking. + public static NumericRangeResolution NumericRangeResolution(RangeKind rangeKind = default, double minimum = default, double maximum = default) + { + return new NumericRangeResolution(ResolutionKind.NumericRangeResolution, serializedAdditionalRawData: null, rangeKind, minimum, maximum); + } + + /// Initializes a new instance of . + /// The Subtype of an extracted entity type. + /// List of entity tags. Tags express similarities between entity categories for the extracted entity type. + /// A new instance for mocking. + public static EntitySubtype EntitySubtype(string value = null, IEnumerable tags = null) + { + tags ??= new List(); + + return new EntitySubtype(ExtraInformationKind.EntitySubtype, serializedAdditionalRawData: null, value, tags?.ToList()); + } + + /// Initializes a new instance of . + /// The name of the tag. + /// The confidence score of the tag for the extracted entity between 0.0 and 1.0. + /// A new instance for mocking. + public static EntityTag EntityTag(string name = null, double? confidenceScore = null) + { + return new EntityTag(name, confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The canonical form of the extracted entity. + /// A new instance for mocking. + public static ListKey ListKey(string key = null) + { + return new ListKey(ExtraInformationKind.ListKey, serializedAdditionalRawData: null, key); + } + + /// Initializes a new instance of . + /// The key of the regex pattern used in extracting the entity. + /// The .NET regex pattern used in extracting the entity. Please visit https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. + /// A new instance for mocking. + public static RegexKey RegexKey(string key = null, string regexPattern = null) + { + return new RegexKey(ExtraInformationKind.RegexKey, serializedAdditionalRawData: null, key, regexPattern); + } + + /// Initializes a new instance of . + /// The intent with the highest score. + /// + /// A dictionary that contains all intents. A key is an intent name and a value is its confidence score and target type. The top intent's value also contains the actual response from the target project. + /// 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 OrchestrationPrediction OrchestrationPrediction(string topIntent = null, IReadOnlyDictionary intents = null) + { + intents ??= new Dictionary(); + + return new OrchestrationPrediction(ProjectKind.Orchestration, topIntent, serializedAdditionalRawData: null, intents); + } + + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// A new instance for mocking. + public static TargetIntentResult TargetIntentResult(string targetProjectKind = null, string apiVersion = null, double confidence = default) + { + return new UnknownTargetIntentResult(targetProjectKind == null ? default : new TargetProjectKind(targetProjectKind), apiVersion, confidence, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// The actual response from a Conversation project. + /// A new instance for mocking. + public static NoneLinkedTargetIntentResult NoneLinkedTargetIntentResult(string apiVersion = null, double confidence = default, ConversationResult result = null) + { + return new NoneLinkedTargetIntentResult(TargetProjectKind.NonLinked, apiVersion, confidence, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// The same query given in request. + /// The detected language from the query in BCP 47 language representation. + /// The predicted result for the query. + /// A new instance for mocking. + public static ConversationResult ConversationResult(string query = null, string detectedLanguage = null, ConversationPrediction prediction = null) + { + return new ConversationResult(query, detectedLanguage, prediction, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// The actual response from a Conversation project. + /// A new instance for mocking. + public static ConversationTargetIntentResult ConversationTargetIntentResult(string apiVersion = null, double confidence = default, ConversationResult result = null) + { + return new ConversationTargetIntentResult(TargetProjectKind.Conversation, apiVersion, confidence, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// The actual response from a LUIS Generally Available application. + /// A new instance for mocking. + public static LuisTargetIntentResult LuisTargetIntentResult(string apiVersion = null, double confidence = default, LuisResult result = null) + { + return new LuisTargetIntentResult(TargetProjectKind.Luis, apiVersion, confidence, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// Additional Properties. + /// A new instance for mocking. + public static LuisResult LuisResult(IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new LuisResult(additionalProperties); + } + + /// Initializes a new instance of . + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// The generated answer by a Question Answering KB. + /// A new instance for mocking. + public static QuestionAnsweringTargetIntentResult QuestionAnsweringTargetIntentResult(string apiVersion = null, double confidence = default, AnswersResult result = null) + { + return new QuestionAnsweringTargetIntentResult(TargetProjectKind.QuestionAnswering, apiVersion, confidence, serializedAdditionalRawData: null, result); + } + + /// Initializes a new instance of . + /// Represents Answer Result list. + /// A new instance for mocking. + public static AnswersResult AnswersResult(IEnumerable answers = null) + { + answers ??= new List(); + + return new AnswersResult(answers?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of questions associated with the answer. + /// Answer text. + /// Answer confidence score, value ranges from 0 to 1. + /// ID of the QnA result. + /// Source of QnA result. + /// Metadata associated with the answer, useful to categorize or filter question answers. + /// Dialog associated with Answer. + /// Answer span object of QnA with respect to user's question. + /// A new instance for mocking. + public static KnowledgeBaseAnswer KnowledgeBaseAnswer(IEnumerable questions = null, string answer = null, double? confidence = null, int? qnaId = null, string source = null, IReadOnlyDictionary metadata = null, KnowledgeBaseAnswerDialog dialog = null, AnswerSpan shortAnswer = null) + { + questions ??= new List(); + metadata ??= new Dictionary(); + + return new KnowledgeBaseAnswer( + questions?.ToList(), + answer, + confidence, + qnaId, + source, + metadata, + dialog, + shortAnswer, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. + /// List of prompts associated with the answer. + /// A new instance for mocking. + public static KnowledgeBaseAnswerDialog KnowledgeBaseAnswerDialog(bool? isContextOnly = null, IEnumerable prompts = null) + { + prompts ??= new List(); + + return new KnowledgeBaseAnswerDialog(isContextOnly, prompts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Index of the prompt - used in ordering of the prompts. + /// QnA ID corresponding to the prompt. + /// Text displayed to represent a follow up question prompt. + /// A new instance for mocking. + public static KnowledgeBaseAnswerPrompt KnowledgeBaseAnswerPrompt(int? displayOrder = null, int? qnaId = null, string displayText = null) + { + return new KnowledgeBaseAnswerPrompt(displayOrder, qnaId, displayText, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Predicted text of answer span. + /// Predicted score of answer span, value ranges from 0 to 1. + /// The answer span offset from the start of answer. + /// The length of the answer span. + /// A new instance for mocking. + public static AnswerSpan AnswerSpan(string text = null, double? confidenceScore = null, int? offset = null, int? length = null) + { + return new AnswerSpan(text, confidenceScore, offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// display name. + /// Date and time job created. + /// Date and time job expires. + /// job ID. + /// last updated date and time. + /// status. + /// errors. + /// next link. + /// Contains the state for the tasks that are being executed as part of the submitted job for analyzing a conversation. + /// Contains the statistics for the submitted job. + /// A new instance for mocking. + public static AnalyzeConversationOperationState AnalyzeConversationOperationState(string displayName = null, DateTimeOffset createdDateTime = default, DateTimeOffset? expirationDateTime = null, Guid jobId = default, DateTimeOffset lastUpdatedDateTime = default, ConversationActionState status = default, IEnumerable errors = null, string nextLink = null, ConversationActions actions = null, ConversationRequestStatistics statistics = null) + { + errors ??= new List(); + + return new AnalyzeConversationOperationState( + displayName, + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors?.ToList(), + nextLink, + actions, + 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 ConversationError ConversationError(ConversationErrorCode code = default, string message = null, string target = null, IEnumerable details = null, InnerErrorModel innererror = null) + { + details ??= new List(); + + return new ConversationError( + 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 tasks that finished successfully. + /// Count of tasks that failed. + /// Count of tasks that are currently in progress. + /// Total count of tasks submitted as part of the job. + /// + /// List of results from tasks (if available). + /// 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 ConversationActions ConversationActions(int completed = default, int failed = default, int inProgress = default, int total = default, IEnumerable items = null) + { + items ??= new List(); + + return new ConversationActions( + 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. + /// discriminator kind. + /// A new instance for mocking. + public static AnalyzeConversationOperationResult AnalyzeConversationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, string kind = null) + { + return new UnknownAnalyzeConversationOperationResult(lastUpdateDateTime, status, name, kind == null ? default : new AnalyzeConversationOperationResultsKind(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. + /// results. + /// A new instance for mocking. + public static ConversationPiiOperationResult ConversationPiiOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, ConversationPiiResults results = null) + { + return new ConversationPiiOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeConversationOperationResultsKind.PiiOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// statistics. + /// This field indicates which model is used for scoring. + /// array of conversations. + /// A new instance for mocking. + public static ConversationPiiResults ConversationPiiResults(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable conversations = null) + { + errors ??= new List(); + conversations ??= new List(); + + return new ConversationPiiResults(errors?.ToList(), statistics, modelVersion, conversations?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// A new instance for mocking. + public static DocumentError DocumentError(string id = null, ConversationError error = null) + { + return new DocumentError(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 conversation identifier. + /// Warnings encountered in processing the document. + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + /// List of conversationItems. + /// A new instance for mocking. + public static ConversationalPiiResultWithResultBase ConversationalPiiResultWithResultBase(string id = null, IEnumerable warnings = null, ConversationStatistics statistics = null, IEnumerable conversationItems = null) + { + warnings ??= new List(); + conversationItems ??= new List(); + + return new ConversationalPiiResultWithResultBase(id, warnings?.ToList(), statistics, conversationItems?.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 InputWarning InputWarning(string code = null, string message = null, string targetRef = null) + { + return new InputWarning(code, message, targetRef, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of text units for the request. + /// A new instance for mocking. + public static ConversationStatistics ConversationStatistics(int transactionsCount = default) + { + return new ConversationStatistics(transactionsCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Id of the result. + /// Transcript content response that the service generates, with all necessary personally identifiable information redacted. + /// Array of Entities. + /// A new instance for mocking. + public static ConversationPiiItemResult ConversationPiiItemResult(string id = null, RedactedTranscriptContent redactedContent = null, IEnumerable entities = null) + { + entities ??= new List(); + + return new ConversationPiiItemResult(id, redactedContent, entities?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Redacted output for input in inverse-text-normalized format. + /// Redacted output for input in masked inverse-text-normalized format. + /// Redacted output for input in text (Microsoft's speech-to-text 'display') format. + /// Redacted output for input in lexical format. + /// List of redacted audio segments. + /// A new instance for mocking. + public static RedactedTranscriptContent RedactedTranscriptContent(string inverseTextNormalized = null, string maskedInverseTextNormalized = null, string text = null, string lexical = null, IEnumerable audioTimings = null) + { + audioTimings ??= new List(); + + return new RedactedTranscriptContent( + inverseTextNormalized, + maskedInverseTextNormalized, + text, + lexical, + audioTimings?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + /// A new instance for mocking. + public static AudioTiming AudioTiming(long? offset = null, long? duration = null) + { + return new AudioTiming(offset, duration, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// A new instance for mocking. + public static NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default) + { + return new NamedEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// results. + /// A new instance for mocking. + public static SummarizationOperationResult SummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, SummaryResult results = null) + { + return new SummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeConversationOperationResultsKind.SummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// array of conversations. + /// Errors by document id. + /// statistics. + /// This field indicates which model is used for scoring. + /// A new instance for mocking. + public static SummaryResult SummaryResult(IEnumerable conversations = null, IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null) + { + conversations ??= new List(); + errors ??= new List(); + + return new SummaryResult(conversations?.ToList(), errors?.ToList(), statistics, modelVersion, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty conversation identifier. + /// Warnings encountered in processing the document. + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + /// array of summaries. + /// A new instance for mocking. + public static ConversationsSummaryResult ConversationsSummaryResult(string id = null, IEnumerable warnings = null, ConversationStatistics statistics = null, IEnumerable summaries = null) + { + warnings ??= new List(); + summaries ??= new List(); + + return new ConversationsSummaryResult(id, warnings?.ToList(), statistics, summaries?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// aspect. + /// text. + /// Context list of the summary. + /// A new instance for mocking. + public static SummaryResultItem SummaryResultItem(string aspect = null, string text = null, IEnumerable contexts = null) + { + contexts ??= new List(); + + return new SummaryResultItem(aspect, text, contexts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// Reference to the ID of ConversationItem. + /// A new instance for mocking. + public static ItemizedSummaryContext ItemizedSummaryContext(int offset = default, int length = default, string conversationItemId = null) + { + return new ItemizedSummaryContext(offset, length, conversationItemId, 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. + /// Custom Summary Result. + /// A new instance for mocking. + public static CustomSummarizationOperationResult CustomSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, ConversationActionState status = default, string name = null, CustomSummaryResult results = null) + { + return new CustomSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeConversationOperationResultsKind.CustomSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// array of conversations. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomSummaryResult CustomSummaryResult(IEnumerable conversations = null, IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null) + { + conversations ??= new List(); + errors ??= new List(); + + return new CustomSummaryResult( + conversations?.ToList(), + errors?.ToList(), + statistics, + projectName, + deploymentName, + 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. + /// Number of conversations submitted in the request. + /// Number of conversation documents. This excludes documents that are empty, over the size limit, or in unsupported languages. + /// Number of invalid documents. This includes documents that are empty, over the size limit, or in unsupported languages. + /// A new instance for mocking. + public static ConversationRequestStatistics ConversationRequestStatistics(int documentsCount = default, int validDocumentsCount = default, int erroneousDocumentsCount = default, long transactionsCount = default, int conversationsCount = default, int validConversationsCount = default, int erroneousConversationsCount = default) + { + return new ConversationRequestStatistics( + documentsCount, + validDocumentsCount, + erroneousDocumentsCount, + transactionsCount, + conversationsCount, + validConversationsCount, + erroneousConversationsCount, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// modality. + /// domain. + /// A new instance for mocking. + public static ConversationInput ConversationInput(string id = null, string language = null, string modality = null, ConversationDomain? domain = null) + { + return new UnknownConversationInput(id, language, modality == null ? default : new InputModality(modality), domain, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// domain. + /// Ordered list of text conversation items in the conversation. + /// A new instance for mocking. + public static TextConversation TextConversation(string id = null, string language = null, ConversationDomain? domain = null, IEnumerable conversationItems = null) + { + conversationItems ??= new List(); + + return new TextConversation( + id, + language, + InputModality.Text, + domain, + serializedAdditionalRawData: null, + conversationItems?.ToList()); + } + + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// domain. + /// Ordered list of transcript conversation items in the conversation. + /// A new instance for mocking. + public static TranscriptConversation TranscriptConversation(string id = null, string language = null, ConversationDomain? domain = null, IEnumerable conversationItems = null) + { + conversationItems ??= new List(); + + return new TranscriptConversation( + id, + language, + InputModality.Transcript, + domain, + serializedAdditionalRawData: null, + conversationItems?.ToList()); + } + + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// The override language of a conversation item in BCP 47 language representation. + /// Enumeration of supported conversational modalities. + /// Role of the participant. + /// Inverse text normalization (ITN) representation of input. The inverse-text-normalized form is the recognized text from Microsoft's speech-to-text API, with phone numbers, numbers, abbreviations, and other transformations applied. + /// Inverse-text-normalized format with profanity masking applied. + /// Display form of the recognized text from the speech-to-text API, with punctuation and capitalization added. + /// Lexical form of the recognized text from the speech-to-text API, with the actual words recognized. + /// List of word-level audio timing information. + /// Audio timing at the conversation item level. This still can help with AI quality if word-level audio timings are not available. + /// A new instance for mocking. + public static TranscriptConversationItem TranscriptConversationItem(string id = null, string participantId = null, string language = null, InputModality? modality = null, ParticipantRole? role = null, string inverseTextNormalized = null, string maskedInverseTextNormalized = null, string text = null, string lexical = null, IEnumerable wordLevelTimings = null, ConversationItemLevelTiming conversationItemLevelTiming = null) + { + wordLevelTimings ??= new List(); + + return new TranscriptConversationItem( + id, + participantId, + language, + modality, + role, + inverseTextNormalized, + maskedInverseTextNormalized, + text, + lexical, + wordLevelTimings?.ToList(), + conversationItemLevelTiming, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// It controls the approximate number of sentences in the output summaries. + /// String index type. + /// Controls the approximate length of the output summaries. Recommended to use summaryLength over sentenceCount. + /// Array of Summary Aspects. + /// A new instance for mocking. + public static CustomConversationSummarizationActionContent CustomConversationSummarizationActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, int? sentenceCount = null, StringIndexType? stringIndexType = null, SummaryLengthBucket? summaryLength = null, IEnumerable summaryAspects = null) + { + summaryAspects ??= new List(); + + return new CustomConversationSummarizationActionContent( + loggingOptOut, + projectName, + deploymentName, + sentenceCount, + stringIndexType, + summaryLength, + summaryAspects?.ToList(), + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs index 163fadec41d07..3a91e692bd81d 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClient.cs @@ -6,18 +6,24 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; using System.Threading.Tasks; +using Azure.AI.Language.Conversations.Models; using Azure.Core; using Azure.Core.Pipeline; namespace Azure.AI.Language.Conversations { // Data plane generated client. - /// The ConversationAnalysis service client. + /// The language service conversations API is a suite of natural language processing (NLP) skills that can be used to analyze structured conversations (textual or spoken). The synchronous API in this suite accepts a request and mediates among multiple language projects, such as LUIS Generally Available, Question Answering, Conversational Language Understanding, and then calls the best candidate service to handle the request. At last, it returns a response with the candidate service's response as a payload.\n\n In some cases, this API needs to forward requests and responses between the caller and an upstream service. The asynchronous APIs in this suite enable tasks like Conversation Summarization and Conversational PII detection. public partial class ConversationAnalysisClient { 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; @@ -34,23 +40,23 @@ protected ConversationAnalysisClient() } /// Initializes a new instance of ConversationAnalysisClient. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.cognitiveservices.azure.com). + /// 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 ConversationAnalysisClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new ConversationsClientOptions()) + public ConversationAnalysisClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new ConversationAnalysisClientOptions()) { } /// Initializes a new instance of ConversationAnalysisClient. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.cognitiveservices.azure.com). + /// 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 ConversationAnalysisClient(Uri endpoint, AzureKeyCredential credential, ConversationsClientOptions options) + public ConversationAnalysisClient(Uri endpoint, AzureKeyCredential credential, ConversationAnalysisClientOptions options) { Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(credential, nameof(credential)); - options ??= new ConversationsClientOptions(); + options ??= new ConversationAnalysisClientOptions(); ClientDiagnostics = new ClientDiagnostics(options, true); _keyCredential = credential; @@ -59,6 +65,48 @@ public ConversationAnalysisClient(Uri endpoint, AzureKeyCredential credential, C _apiVersion = options.Version; } + /// Initializes a new instance of ConversationAnalysisClient. + /// 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 ConversationAnalysisClient(Uri endpoint, TokenCredential credential, ConversationAnalysisClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new ConversationAnalysisClientOptions(); + + 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; + } + + /// Analyzes the input conversation utterance. + /// The base class of a conversation input task. + /// The cancellation token to use. + /// + public virtual async Task> AnalyzeConversationAsync(AnalyzeConversationInputKind kind, CancellationToken cancellationToken = default) + { + AnalyzeConversationInput analyzeConversationInput = new Models.AnalyzeConversationInput(kind, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeConversationAsync(analyzeConversationInput.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(AnalyzeConversationActionResult.FromResponse(response), response); + } + + /// Analyzes the input conversation utterance. + /// The base class of a conversation input task. + /// The cancellation token to use. + /// + public virtual Response AnalyzeConversation(AnalyzeConversationInputKind kind, CancellationToken cancellationToken = default) + { + AnalyzeConversationInput analyzeConversationInput = new Models.AnalyzeConversationInput(kind, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeConversation(analyzeConversationInput.ToRequestContent(), context); + return Response.FromValue(AnalyzeConversationActionResult.FromResponse(response), response); + } + /// /// [Protocol Method] Analyzes the input conversation utterance. /// @@ -67,6 +115,11 @@ public ConversationAnalysisClient(Uri endpoint, AzureKeyCredential credential, C /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The content to send as the body of the request. @@ -101,6 +154,11 @@ public virtual async Task AnalyzeConversationAsync(RequestContent cont /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The content to send as the body of the request. @@ -127,6 +185,32 @@ public virtual Response AnalyzeConversation(RequestContent content, RequestConte } } + /// Get analysis status and results. + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The cancellation token to use. + /// Get the status of an analysis job. A job can consist of one or more tasks. After all tasks succeed, the job transitions to the succeeded state and results are available for each task. + /// + public virtual async Task> AnalyzeConversationOperationStatusAsync(Guid jobId, bool? showStats = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeConversationOperationStatusAsync(jobId, showStats, context).ConfigureAwait(false); + return Response.FromValue(AnalyzeConversationOperationState.FromResponse(response), response); + } + + /// Get analysis status and results. + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The cancellation token to use. + /// Get the status of an analysis job. A job can consist of one or more tasks. After all tasks succeed, the job transitions to the succeeded state and results are available for each task. + /// + public virtual Response AnalyzeConversationOperationStatus(Guid jobId, bool? showStats = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeConversationOperationStatus(jobId, showStats, context); + return Response.FromValue(AnalyzeConversationOperationState.FromResponse(response), response); + } + /// /// [Protocol Method] Get analysis status and results /// @@ -135,21 +219,26 @@ public virtual Response AnalyzeConversation(RequestContent content, RequestConte /// 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. + /// job ID. /// (Optional) if set to true, response will contain request and document level statistics. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetAnalyzeConversationJobStatusAsync(Guid jobId, bool? showStats = null, RequestContext context = null) + /// + public virtual async Task AnalyzeConversationOperationStatusAsync(Guid jobId, bool? showStats, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.GetAnalyzeConversationJobStatus"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversationOperationStatus"); scope.Start(); try { - using HttpMessage message = CreateGetAnalyzeConversationJobStatusRequest(jobId, showStats, context); + using HttpMessage message = CreateAnalyzeConversationOperationStatusRequest(jobId, showStats, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -167,21 +256,26 @@ public virtual async Task GetAnalyzeConversationJobStatusAsync(Guid jo /// 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. + /// job ID. /// (Optional) if set to true, response will contain request and document level statistics. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetAnalyzeConversationJobStatus(Guid jobId, bool? showStats = null, RequestContext context = null) + /// + public virtual Response AnalyzeConversationOperationStatus(Guid jobId, bool? showStats, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.GetAnalyzeConversationJobStatus"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversationOperationStatus"); scope.Start(); try { - using HttpMessage message = CreateGetAnalyzeConversationJobStatusRequest(jobId, showStats, context); + using HttpMessage message = CreateAnalyzeConversationOperationStatusRequest(jobId, showStats, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -191,14 +285,55 @@ public virtual Response GetAnalyzeConversationJobStatus(Guid jobId, bool? showSt } } + /// Analyzes the input conversation utterance. + /// 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. + /// Analysis Input. + /// Set of tasks to execute on the input conversation. + /// Display name for the analysis job. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task AnalyzeConversationSubmitOperationAsync(WaitUntil waitUntil, MultiLanguageConversationInput conversationInput, IEnumerable actions, string displayName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(conversationInput, nameof(conversationInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(displayName, conversationInput, actions.ToList(), null); + RequestContext context = FromCancellationToken(cancellationToken); + return await AnalyzeConversationSubmitOperationAsync(waitUntil, analyzeConversationOperationInput.ToRequestContent(), context).ConfigureAwait(false); + } + + /// Analyzes the input conversation utterance. + /// 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. + /// Analysis Input. + /// Set of tasks to execute on the input conversation. + /// Display name for the analysis job. + /// The cancellation token to use. + /// or is null. + /// + public virtual Operation AnalyzeConversationSubmitOperation(WaitUntil waitUntil, MultiLanguageConversationInput conversationInput, IEnumerable actions, string displayName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(conversationInput, nameof(conversationInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + AnalyzeConversationOperationInput analyzeConversationOperationInput = new AnalyzeConversationOperationInput(displayName, conversationInput, actions.ToList(), null); + RequestContext context = FromCancellationToken(cancellationToken); + return AnalyzeConversationSubmitOperation(waitUntil, analyzeConversationOperationInput.ToRequestContent(), context); + } + /// - /// [Protocol Method] Submit analysis job for conversations + /// [Protocol Method] Analyzes the input conversation utterance. /// /// /// /// 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. @@ -207,17 +342,17 @@ public virtual Response GetAnalyzeConversationJobStatus(Guid jobId, bool? showSt /// is null. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual async Task> AnalyzeConversationsAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual async Task AnalyzeConversationSubmitOperationAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversations"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversationSubmitOperation"); scope.Start(); try { - using HttpMessage message = CreateAnalyzeConversationsRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateAnalyzeConversationSubmitOperationRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversationSubmitOperation", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -227,13 +362,18 @@ public virtual async Task> AnalyzeConversationsAsync(WaitU } /// - /// [Protocol Method] Submit analysis job for conversations + /// [Protocol Method] Analyzes the input conversation utterance. /// /// /// /// 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. @@ -242,17 +382,17 @@ public virtual async Task> AnalyzeConversationsAsync(WaitU /// is null. /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. - /// - public virtual Operation AnalyzeConversations(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + /// + public virtual Operation AnalyzeConversationSubmitOperation(WaitUntil waitUntil, RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversations"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversationSubmitOperation"); scope.Start(); try { - using HttpMessage message = CreateAnalyzeConversationsRequest(content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateAnalyzeConversationSubmitOperationRequest(content, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversationSubmitOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -261,8 +401,9 @@ public virtual Operation AnalyzeConversations(WaitUntil waitUntil, R } } + // 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 conversations job + /// [Protocol Method] Cancel a long-running Text Analysis conversations job. /// /// /// @@ -272,19 +413,19 @@ public virtual Operation AnalyzeConversations(WaitUntil waitUntil, R /// /// /// 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. - /// Job ID. + /// 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 CancelAnalyzeConversationsAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + /// + public virtual async Task AnalyzeConversationCancelOperationAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.CancelAnalyzeConversations"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversationCancelOperation"); scope.Start(); try { - using HttpMessage message = CreateCancelAnalyzeConversationsRequest(jobId, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.CancelAnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + using HttpMessage message = CreateAnalyzeConversationCancelOperationRequest(jobId, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversationCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -293,8 +434,9 @@ public virtual async Task CancelAnalyzeConversationsAsync(WaitUntil w } } + // 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 conversations job + /// [Protocol Method] Cancel a long-running Text Analysis conversations job. /// /// /// @@ -304,19 +446,19 @@ public virtual async Task CancelAnalyzeConversationsAsync(WaitUntil w /// /// /// 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. - /// Job ID. + /// 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 CancelAnalyzeConversations(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + /// + public virtual Operation AnalyzeConversationCancelOperation(WaitUntil waitUntil, Guid jobId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.CancelAnalyzeConversations"); + using var scope = ClientDiagnostics.CreateScope("ConversationAnalysisClient.AnalyzeConversationCancelOperation"); scope.Start(); try { - using HttpMessage message = CreateCancelAnalyzeConversationsRequest(jobId, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.CancelAnalyzeConversations", OperationFinalStateVia.Location, context, waitUntil); + using HttpMessage message = CreateAnalyzeConversationCancelOperationRequest(jobId, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "ConversationAnalysisClient.AnalyzeConversationCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { @@ -342,44 +484,44 @@ internal HttpMessage CreateAnalyzeConversationRequest(RequestContent content, Re return message; } - internal HttpMessage CreateAnalyzeConversationsRequest(RequestContent content, RequestContext context) + internal HttpMessage CreateAnalyzeConversationOperationStatusRequest(Guid jobId, bool? showStats, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); + var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/language", false); - uri.AppendPath("/analyze-conversations/jobs", false); + uri.AppendPath("/analyze-conversations/jobs/", false); + uri.AppendPath(jobId, true); uri.AppendQuery("api-version", _apiVersion, true); + if (showStats != null) + { + uri.AppendQuery("showStats", showStats.Value, true); + } request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; return message; } - internal HttpMessage CreateGetAnalyzeConversationJobStatusRequest(Guid jobId, bool? showStats, RequestContext context) + internal HttpMessage CreateAnalyzeConversationSubmitOperationRequest(RequestContent content, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/language", false); - uri.AppendPath("/analyze-conversations/jobs/", false); - uri.AppendPath(jobId, true); + uri.AppendPath("/analyze-conversations/jobs", false); uri.AppendQuery("api-version", _apiVersion, true); - if (showStats != null) - { - uri.AppendQuery("showStats", showStats.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; return message; } - internal HttpMessage CreateCancelAnalyzeConversationsRequest(Guid jobId, RequestContext context) + internal HttpMessage CreateAnalyzeConversationCancelOperationRequest(Guid jobId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier202); var request = message.Request; @@ -396,10 +538,19 @@ internal HttpMessage CreateCancelAnalyzeConversationsRequest(Guid jobId, Request 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 _responseClassifier200202; - private static ResponseClassifier ResponseClassifier200202 => _responseClassifier200202 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202 }); private static ResponseClassifier _responseClassifier202; private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientExtensions.cs index fdf861afc3da4..7a66cd830e38f 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientExtensions.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientExtensions.cs @@ -8,49 +8,39 @@ using System; using Azure; using Azure.AI.Language.Conversations; -using Azure.AI.Language.Conversations.Authoring; using Azure.Core.Extensions; namespace Microsoft.Extensions.Azure { - /// Extension methods to add , to client builder. + /// Extension methods to add to client builder. public static partial class ConversationAnalysisClientExtensions { /// Registers a instance. /// The builder to register with. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.cognitiveservices.azure.com). + /// 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 AddConversationAnalysisClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + public static IAzureClientBuilder AddConversationAnalysisClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) where TBuilder : IAzureClientFactoryBuilder { - return builder.RegisterClientFactory((options) => new ConversationAnalysisClient(endpoint, credential, options)); + return builder.RegisterClientFactory((options) => new ConversationAnalysisClient(endpoint, credential, options)); } - /// Registers a instance. + /// Registers a instance. /// The builder to register with. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.cognitiveservices.azure.com). - /// A credential used to authenticate to an Azure Service. - public static IAzureClientBuilder AddConversationAuthoringClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) - where TBuilder : IAzureClientFactoryBuilder + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + public static IAzureClientBuilder AddConversationAnalysisClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options) => new ConversationAuthoringClient(endpoint, credential, options)); + return builder.RegisterClientFactory((options, cred) => new ConversationAnalysisClient(endpoint, cred, options)); } /// Registers a instance. /// The builder to register with. /// The configuration values. - public static IAzureClientBuilder AddConversationAnalysisClient(this TBuilder builder, TConfiguration configuration) - where TBuilder : IAzureClientFactoryBuilderWithConfiguration - { - return builder.RegisterClientFactory(configuration); - } - /// Registers a instance. - /// The builder to register with. - /// The configuration values. - public static IAzureClientBuilder AddConversationAuthoringClient(this TBuilder builder, TConfiguration configuration) + public static IAzureClientBuilder AddConversationAnalysisClient(this TBuilder builder, TConfiguration configuration) where TBuilder : IAzureClientFactoryBuilderWithConfiguration { - return builder.RegisterClientFactory(configuration); + return builder.RegisterClientFactory(configuration); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientOptions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientOptions.cs new file mode 100644 index 0000000000000..fb6c59513bd1b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAnalysisClientOptions.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.Language.Conversations +{ + /// Client options for ConversationAnalysisClient. + public partial class ConversationAnalysisClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2024_05_15_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-05-01". + V2022_05_01 = 1, + /// Service version "2023-04-01". + V2023_04_01 = 2, + /// Service version "2024-05-01". + V2024_05_01 = 3, + /// Service version "2024-05-15-preview". + V2024_05_15_Preview = 4, + } + + internal string Version { get; } + + /// Initializes new instance of ConversationAnalysisClientOptions. + public ConversationAnalysisClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_05_01 => "2022-05-01", + ServiceVersion.V2023_04_01 => "2023-04-01", + ServiceVersion.V2024_05_01 => "2024-05-01", + ServiceVersion.V2024_05_15_Preview => "2024-05-15-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs deleted file mode 100644 index 700d8a25b465a..0000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/ConversationAuthoringClient.cs +++ /dev/null @@ -1,2803 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.AI.Language.Conversations.Authoring -{ - // Data plane generated client. - /// The ConversationAuthoring service client. - public partial class ConversationAuthoringClient - { - private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; - private readonly AzureKeyCredential _keyCredential; - 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 ConversationAuthoringClient for mocking. - protected ConversationAuthoringClient() - { - } - - /// Initializes a new instance of ConversationAuthoringClient. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.cognitiveservices.azure.com). - /// A credential used to authenticate to an Azure Service. - /// or is null. - public ConversationAuthoringClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new ConversationsClientOptions()) - { - } - - /// Initializes a new instance of ConversationAuthoringClient. - /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.cognitiveservices.azure.com). - /// A credential used to authenticate to an Azure Service. - /// The options for configuring the client. - /// or is null. - public ConversationAuthoringClient(Uri endpoint, AzureKeyCredential credential, ConversationsClientOptions options) - { - Argument.AssertNotNull(endpoint, nameof(endpoint)); - Argument.AssertNotNull(credential, nameof(credential)); - options ??= new ConversationsClientOptions(); - - 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; - } - - /// - /// [Protocol Method] Creates a new project or updates an existing one. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// 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. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task CreateProjectAsync(string projectName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.CreateProject"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateProjectRequest(projectName, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new project or updates an existing one. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// 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. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response CreateProject(string projectName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.CreateProject"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateProjectRequest(projectName, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the details of a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetProjectAsync(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetProject"); - scope.Start(); - try - { - using HttpMessage message = CreateGetProjectRequest(projectName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the details of a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetProject(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetProject"); - scope.Start(); - try - { - using HttpMessage message = CreateGetProjectRequest(projectName, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the details of a deployment. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The name of the specific deployment of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetDeploymentAsync(string projectName, string deploymentName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDeploymentRequest(projectName, deploymentName, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the details of a deployment. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The name of the specific deployment of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetDeployment(string projectName, string deploymentName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDeploymentRequest(projectName, deploymentName, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status of an existing deployment job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The name of the specific deployment of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetDeploymentJobStatusAsync(string projectName, string deploymentName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetDeploymentJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDeploymentJobStatusRequest(projectName, deploymentName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status of an existing deployment job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The name of the specific deployment of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetDeploymentJobStatus(string projectName, string deploymentName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetDeploymentJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetDeploymentJobStatusRequest(projectName, deploymentName, jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status of an existing swap deployment job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetSwapDeploymentsJobStatusAsync(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetSwapDeploymentsJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSwapDeploymentsJobStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status of an existing swap deployment job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetSwapDeploymentsJobStatus(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetSwapDeploymentsJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetSwapDeploymentsJobStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status of an export job. Once job completes, returns the project metadata, and assets. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetExportProjectJobStatusAsync(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetExportProjectJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetExportProjectJobStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status of an export job. Once job completes, returns the project metadata, and assets. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetExportProjectJobStatus(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetExportProjectJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetExportProjectJobStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for an import. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetImportProjectJobStatusAsync(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetImportProjectJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetImportProjectJobStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for an import. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetImportProjectJobStatus(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetImportProjectJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetImportProjectJobStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the details of a trained model. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetTrainedModelAsync(string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetTrainedModel"); - scope.Start(); - try - { - using HttpMessage message = CreateGetTrainedModelRequest(projectName, trainedModelLabel, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the details of a trained model. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetTrainedModel(string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetTrainedModel"); - scope.Start(); - try - { - using HttpMessage message = CreateGetTrainedModelRequest(projectName, trainedModelLabel, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes an existing trained model. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task DeleteTrainedModelAsync(string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeleteTrainedModel"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteTrainedModelRequest(projectName, trainedModelLabel, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes an existing trained model. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response DeleteTrainedModel(string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeleteTrainedModel"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteTrainedModelRequest(projectName, trainedModelLabel, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the evaluation summary of a trained model. The summary includes high level performance measurements of the model e.g., F1, Precision, Recall, etc. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetModelEvaluationSummaryAsync(string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetModelEvaluationSummary"); - scope.Start(); - try - { - using HttpMessage message = CreateGetModelEvaluationSummaryRequest(projectName, trainedModelLabel, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the evaluation summary of a trained model. The summary includes high level performance measurements of the model e.g., F1, Precision, Recall, etc. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetModelEvaluationSummary(string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetModelEvaluationSummary"); - scope.Start(); - try - { - using HttpMessage message = CreateGetModelEvaluationSummaryRequest(projectName, trainedModelLabel, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for loading a snapshot. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetLoadSnapshotJobStatusAsync(string projectName, string trainedModelLabel, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetLoadSnapshotJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLoadSnapshotJobStatusRequest(projectName, trainedModelLabel, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for loading a snapshot. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLoadSnapshotJobStatus(string projectName, string trainedModelLabel, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetLoadSnapshotJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLoadSnapshotJobStatusRequest(projectName, trainedModelLabel, jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for a training job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetTrainingJobStatusAsync(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetTrainingJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetTrainingJobStatusRequest(projectName, jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for a training job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetTrainingJobStatus(string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetTrainingJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetTrainingJobStatusRequest(projectName, jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for a project deletion job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetProjectDeletionJobStatusAsync(string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetProjectDeletionJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetProjectDeletionJobStatusRequest(jobId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Gets the status for a project deletion job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetProjectDeletionJobStatus(string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.GetProjectDeletionJobStatus"); - scope.Start(); - try - { - using HttpMessage message = CreateGetProjectDeletionJobStatusRequest(jobId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Lists the existing projects. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetProjectsAsync(RequestContext context = null) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetProjects", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the existing projects. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetProjects(RequestContext context = null) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetProjectsRequest(context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetProjectsNextPageRequest(nextLink, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetProjects", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the deployments belonging to a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetDeploymentsAsync(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetDeployments", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the deployments belonging to a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetDeployments(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeploymentsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeploymentsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetDeployments", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the trained models belonging to a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetTrainedModelsAsync(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainedModelsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainedModelsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainedModels", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the trained models belonging to a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetTrainedModels(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainedModelsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainedModelsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainedModels", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Gets the detailed results of the evaluation for a trained model. This includes the raw inference results for the data included in the evaluation process. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// Specifies the method used to interpret string offsets. Set this to "Utf16CodeUnit" for .NET strings, which are encoded as UTF-16. Allowed values: "Utf16CodeUnit". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetModelEvaluationResultsAsync(string projectName, string trainedModelLabel, string stringIndexType = "Utf16CodeUnit", RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - Argument.AssertNotNull(stringIndexType, nameof(stringIndexType)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetModelEvaluationResultsRequest(projectName, trainedModelLabel, stringIndexType, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetModelEvaluationResultsNextPageRequest(nextLink, projectName, trainedModelLabel, stringIndexType, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetModelEvaluationResults", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Gets the detailed results of the evaluation for a trained model. This includes the raw inference results for the data included in the evaluation process. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The trained model label. - /// Specifies the method used to interpret string offsets. Set this to "Utf16CodeUnit" for .NET strings, which are encoded as UTF-16. Allowed values: "Utf16CodeUnit". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetModelEvaluationResults(string projectName, string trainedModelLabel, string stringIndexType = "Utf16CodeUnit", RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - Argument.AssertNotNull(stringIndexType, nameof(stringIndexType)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetModelEvaluationResultsRequest(projectName, trainedModelLabel, stringIndexType, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetModelEvaluationResultsNextPageRequest(nextLink, projectName, trainedModelLabel, stringIndexType, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetModelEvaluationResults", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the non-expired training jobs created for a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetTrainingJobsAsync(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingJobsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingJobsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingJobs", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the non-expired training jobs created for a project. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetTrainingJobs(string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingJobsRequest(projectName, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingJobsNextPageRequest(nextLink, projectName, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingJobs", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the supported languages for the given project type. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The project kind. Allowed values: "Conversation" | "Orchestration". - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetSupportedLanguagesAsync(string projectKind, RequestContext context = null) - { - Argument.AssertNotNull(projectKind, nameof(projectKind)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(projectKind, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedLanguages", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the supported languages for the given project type. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The project kind. Allowed values: "Conversation" | "Orchestration". - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetSupportedLanguages(string projectKind, RequestContext context = null) - { - Argument.AssertNotNull(projectKind, nameof(projectKind)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedLanguagesRequest(projectKind, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedLanguagesNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedLanguages", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the supported prebuilt entities that can be used while creating composed entities. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The language to get supported prebuilt entities for. Required if multilingual is false. This is BCP-47 representation of a language. For example, use "en" for English, "en-gb" for English (UK), "es" for Spanish etc. - /// Whether to get the support prebuilt entities for multilingual or monolingual projects. If true, the language parameter is ignored. - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetSupportedPrebuiltEntitiesAsync(string language = null, bool? multilingual = null, RequestContext context = null) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedPrebuiltEntitiesRequest(language, multilingual, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedPrebuiltEntitiesNextPageRequest(nextLink, language, multilingual, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedPrebuiltEntities", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the supported prebuilt entities that can be used while creating composed entities. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The language to get supported prebuilt entities for. Required if multilingual is false. This is BCP-47 representation of a language. For example, use "en" for English, "en-gb" for English (UK), "es" for Spanish etc. - /// Whether to get the support prebuilt entities for multilingual or monolingual projects. If true, the language parameter is ignored. - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetSupportedPrebuiltEntities(string language = null, bool? multilingual = null, RequestContext context = null) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSupportedPrebuiltEntitiesRequest(language, multilingual, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSupportedPrebuiltEntitiesNextPageRequest(nextLink, language, multilingual, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetSupportedPrebuiltEntities", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the support training config version for a given project type. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The project kind. Allowed values: "Conversation" | "Orchestration". - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual AsyncPageable GetTrainingConfigVersionsAsync(string projectKind, RequestContext context = null) - { - Argument.AssertNotNull(projectKind, nameof(projectKind)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(projectKind, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingConfigVersions", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Lists the support training config version for a given project type. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The project kind. Allowed values: "Conversation" | "Orchestration". - /// 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 from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. - /// - public virtual Pageable GetTrainingConfigVersions(string projectKind, RequestContext context = null) - { - Argument.AssertNotNull(projectKind, nameof(projectKind)); - - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTrainingConfigVersionsRequest(projectKind, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTrainingConfigVersionsNextPageRequest(nextLink, projectKind, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAuthoringClient.GetTrainingConfigVersions", "value", "nextLink", context); - } - - /// - /// [Protocol Method] Deletes a project. - /// - /// - /// - /// 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 name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> DeleteProjectAsync(WaitUntil waitUntil, string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeleteProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteProjectRequest(projectName, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.DeleteProject", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes a project. - /// - /// - /// - /// 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 name of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation DeleteProject(WaitUntil waitUntil, string projectName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeleteProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteProjectRequest(projectName, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.DeleteProject", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a job to export a project's data. - /// - /// - /// - /// 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 name of the project to use. - /// The format of the exported project file to use. Allowed values: "Conversation" | "Luis". - /// Kind of asset to export. - /// Specifies the method used to interpret string offsets. Set this to "Utf16CodeUnit" for .NET strings, which are encoded as UTF-16. Allowed values: "Utf16CodeUnit". - /// Trained model label to export. If the trainedModelLabel is null, the default behavior is to export the current working copy. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> ExportProjectAsync(WaitUntil waitUntil, string projectName, string exportedProjectFormat = null, string assetKind = null, string stringIndexType = "Utf16CodeUnit", string trainedModelLabel = null, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(stringIndexType, nameof(stringIndexType)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.ExportProject"); - scope.Start(); - try - { - using HttpMessage message = CreateExportProjectRequest(projectName, exportedProjectFormat, assetKind, stringIndexType, trainedModelLabel, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.ExportProject", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a job to export a project's data. - /// - /// - /// - /// 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 name of the project to use. - /// The format of the exported project file to use. Allowed values: "Conversation" | "Luis". - /// Kind of asset to export. - /// Specifies the method used to interpret string offsets. Set this to "Utf16CodeUnit" for .NET strings, which are encoded as UTF-16. Allowed values: "Utf16CodeUnit". - /// Trained model label to export. If the trainedModelLabel is null, the default behavior is to export the current working copy. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation ExportProject(WaitUntil waitUntil, string projectName, string exportedProjectFormat = null, string assetKind = null, string stringIndexType = "Utf16CodeUnit", string trainedModelLabel = null, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(stringIndexType, nameof(stringIndexType)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.ExportProject"); - scope.Start(); - try - { - using HttpMessage message = CreateExportProjectRequest(projectName, exportedProjectFormat, assetKind, stringIndexType, trainedModelLabel, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.ExportProject", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - /// - /// - /// - /// 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 name of the project to use. - /// The content to send as the body of the request. - /// The format of the exported project file to use. Allowed values: "Conversation" | "Luis". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> ImportProjectAsync(WaitUntil waitUntil, string projectName, RequestContent content, string exportedProjectFormat = null, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.ImportProject"); - scope.Start(); - try - { - using HttpMessage message = CreateImportProjectRequest(projectName, content, exportedProjectFormat, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.ImportProject", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a job to import a project. If a project with the same name already exists, the data of that project is replaced. - /// - /// - /// - /// 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 name of the project to use. - /// The content to send as the body of the request. - /// The format of the exported project file to use. Allowed values: "Conversation" | "Luis". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation ImportProject(WaitUntil waitUntil, string projectName, RequestContent content, string exportedProjectFormat = null, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.ImportProject"); - scope.Start(); - try - { - using HttpMessage message = CreateImportProjectRequest(projectName, content, exportedProjectFormat, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.ImportProject", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a training job for a project. - /// - /// - /// - /// 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 name of the project to use. - /// 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. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> TrainAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.Train"); - scope.Start(); - try - { - using HttpMessage message = CreateTrainRequest(projectName, content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.Train", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a training job for a project. - /// - /// - /// - /// 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 name of the project to use. - /// 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. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation Train(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.Train"); - scope.Start(); - try - { - using HttpMessage message = CreateTrainRequest(projectName, content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.Train", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Swaps two existing deployments with each other. - /// - /// - /// - /// 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 name of the project to use. - /// 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. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> SwapDeploymentsAsync(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.SwapDeployments"); - scope.Start(); - try - { - using HttpMessage message = CreateSwapDeploymentsRequest(projectName, content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.SwapDeployments", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Swaps two existing deployments with each other. - /// - /// - /// - /// 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 name of the project to use. - /// 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. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation SwapDeployments(WaitUntil waitUntil, string projectName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.SwapDeployments"); - scope.Start(); - try - { - using HttpMessage message = CreateSwapDeploymentsRequest(projectName, content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.SwapDeployments", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new deployment or replaces an existing one. - /// - /// - /// - /// 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 name of the project to use. - /// The name of the specific deployment of the project to use. - /// 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. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> DeployProjectAsync(WaitUntil waitUntil, string projectName, string deploymentName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeployProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.DeployProject", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates a new deployment or replaces an existing one. - /// - /// - /// - /// 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 name of the project to use. - /// The name of the specific deployment of the project to use. - /// 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. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation DeployProject(WaitUntil waitUntil, string projectName, string deploymentName, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeployProject"); - scope.Start(); - try - { - using HttpMessage message = CreateDeployProjectRequest(projectName, deploymentName, content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.DeployProject", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes a project deployment. - /// - /// - /// - /// 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 name of the project to use. - /// The name of the specific deployment of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> DeleteDeploymentAsync(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeleteDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteDeploymentRequest(projectName, deploymentName, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.DeleteDeployment", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Deletes a project deployment. - /// - /// - /// - /// 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 name of the project to use. - /// The name of the specific deployment of the project to use. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation DeleteDeployment(WaitUntil waitUntil, string projectName, string deploymentName, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.DeleteDeployment"); - scope.Start(); - try - { - using HttpMessage message = CreateDeleteDeploymentRequest(projectName, deploymentName, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.DeleteDeployment", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Restores the snapshot of this trained model to be the current working directory of the project. - /// - /// - /// - /// 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 name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task LoadSnapshotAsync(WaitUntil waitUntil, string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.LoadSnapshot"); - scope.Start(); - try - { - using HttpMessage message = CreateLoadSnapshotRequest(projectName, trainedModelLabel, context); - return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.LoadSnapshot", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Restores the snapshot of this trained model to be the current working directory of the project. - /// - /// - /// - /// 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 name of the project to use. - /// The trained model label. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation LoadSnapshot(WaitUntil waitUntil, string projectName, string trainedModelLabel, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(trainedModelLabel, nameof(trainedModelLabel)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.LoadSnapshot"); - scope.Start(); - try - { - using HttpMessage message = CreateLoadSnapshotRequest(projectName, trainedModelLabel, context); - return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.LoadSnapshot", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a cancellation for a running training 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 name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual async Task> CancelTrainingJobAsync(WaitUntil waitUntil, string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.CancelTrainingJob"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelTrainingJobRequest(projectName, jobId, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.CancelTrainingJob", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Triggers a cancellation for a running training 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 name of the project to use. - /// The job ID. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The representing an asynchronous operation on the service. - /// - public virtual Operation CancelTrainingJob(WaitUntil waitUntil, string projectName, string jobId, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); - Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); - - using var scope = ClientDiagnostics.CreateScope("ConversationAuthoringClient.CancelTrainingJob"); - scope.Start(); - try - { - using HttpMessage message = CreateCancelTrainingJobRequest(projectName, jobId, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ConversationAuthoringClient.CancelTrainingJob", OperationFinalStateVia.Location, context, waitUntil); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateGetProjectsRequest(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("/authoring/analyze-conversations/projects", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateProjectRequest(string projectName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200201); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - internal HttpMessage CreateGetProjectRequest(string projectName, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateDeleteProjectRequest(string projectName, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateExportProjectRequest(string projectName, string exportedProjectFormat, string assetKind, string stringIndexType, string trainedModelLabel, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/:export", false); - if (exportedProjectFormat != null) - { - uri.AppendQuery("format", exportedProjectFormat, true); - } - if (assetKind != null) - { - uri.AppendQuery("assetKind", assetKind, true); - } - uri.AppendQuery("stringIndexType", stringIndexType, true); - if (trainedModelLabel != null) - { - uri.AppendQuery("trainedModelLabel", trainedModelLabel, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateImportProjectRequest(string projectName, RequestContent content, string exportedProjectFormat, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/:import", false); - if (exportedProjectFormat != null) - { - uri.AppendQuery("format", exportedProjectFormat, true); - } - 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 CreateTrainRequest(string projectName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/:train", 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 CreateGetDeploymentsRequest(string projectName, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateSwapDeploymentsRequest(string projectName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/:swap", 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 CreateGetDeploymentRequest(string projectName, string deploymentName, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/", false); - uri.AppendPath(deploymentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateDeployProjectRequest(string projectName, string deploymentName, RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/", false); - uri.AppendPath(deploymentName, true); - 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 CreateDeleteDeploymentRequest(string projectName, string deploymentName, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/", false); - uri.AppendPath(deploymentName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetDeploymentJobStatusRequest(string projectName, string deploymentName, string jobId, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/", false); - uri.AppendPath(deploymentName, true); - uri.AppendPath("/jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSwapDeploymentsJobStatusRequest(string projectName, string jobId, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/deployments/swap/jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetExportProjectJobStatusRequest(string projectName, string jobId, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/export/jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetImportProjectJobStatusRequest(string projectName, string jobId, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/import/jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainedModelsRequest(string projectName, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainedModelRequest(string projectName, string trainedModelLabel, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models/", false); - uri.AppendPath(trainedModelLabel, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateDeleteTrainedModelRequest(string projectName, string trainedModelLabel, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier204); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models/", false); - uri.AppendPath(trainedModelLabel, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateLoadSnapshotRequest(string projectName, string trainedModelLabel, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models/", false); - uri.AppendPath(trainedModelLabel, true); - uri.AppendPath("/:load-snapshot", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetModelEvaluationResultsRequest(string projectName, string trainedModelLabel, string stringIndexType, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models/", false); - uri.AppendPath(trainedModelLabel, true); - uri.AppendPath("/evaluation/result", false); - uri.AppendQuery("stringIndexType", stringIndexType, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetModelEvaluationSummaryRequest(string projectName, string trainedModelLabel, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models/", false); - uri.AppendPath(trainedModelLabel, true); - uri.AppendPath("/evaluation/summary-result", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLoadSnapshotJobStatusRequest(string projectName, string trainedModelLabel, string jobId, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/models/", false); - uri.AppendPath(trainedModelLabel, true); - uri.AppendPath("/load-snapshot/jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainingJobsRequest(string projectName, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/train/jobs", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainingJobStatusRequest(string projectName, string jobId, 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("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/train/jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCancelTrainingJobRequest(string projectName, string jobId, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200202); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/language", false); - uri.AppendPath("/authoring/analyze-conversations/projects/", false); - uri.AppendPath(projectName, true); - uri.AppendPath("/train/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; - } - - internal HttpMessage CreateGetProjectDeletionJobStatusRequest(string jobId, 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("/authoring/analyze-conversations/projects/global/deletion-jobs/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSupportedLanguagesRequest(string projectKind, 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("/authoring/analyze-conversations/projects/global/languages", false); - uri.AppendQuery("projectKind", projectKind, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSupportedPrebuiltEntitiesRequest(string language, bool? multilingual, 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("/authoring/analyze-conversations/projects/global/prebuilt-entities", false); - if (language != null) - { - uri.AppendQuery("language", language, true); - } - if (multilingual != null) - { - uri.AppendQuery("multilingual", multilingual.Value, true); - } - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainingConfigVersionsRequest(string projectKind, 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("/authoring/analyze-conversations/projects/global/training-config-versions", false); - uri.AppendQuery("projectKind", projectKind, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetProjectsNextPageRequest(string nextLink, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetDeploymentsNextPageRequest(string nextLink, string projectName, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainedModelsNextPageRequest(string nextLink, string projectName, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetModelEvaluationResultsNextPageRequest(string nextLink, string projectName, string trainedModelLabel, string stringIndexType, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainingJobsNextPageRequest(string nextLink, string projectName, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSupportedLanguagesNextPageRequest(string nextLink, string projectKind, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetSupportedPrebuiltEntitiesNextPageRequest(string nextLink, string language, bool? multilingual, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetTrainingConfigVersionsNextPageRequest(string nextLink, string projectKind, 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.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - private static ResponseClassifier _responseClassifier200; - private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); - private static ResponseClassifier _responseClassifier200201; - private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); - private static ResponseClassifier _responseClassifier200202; - private static ResponseClassifier ResponseClassifier200202 => _responseClassifier200202 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202 }); - private static ResponseClassifier _responseClassifier204; - private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); - private static ResponseClassifier _responseClassifier202; - private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml index 9a7abc4391267..5e6e441619e50 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAnalysisClient.xml @@ -1,22 +1,62 @@ + + +This sample shows how to call AnalyzeConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync(AnalyzeConversationInputKind.Conversation); +]]> +This sample shows how to call AnalyzeConversationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync(AnalyzeConversationInputKind.Conversation); +]]> + + + +This sample shows how to call AnalyzeConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeConversation(AnalyzeConversationInputKind.Conversation); +]]> +This sample shows how to call AnalyzeConversation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeConversation(AnalyzeConversationInputKind.Conversation); +]]> + This sample shows how to call AnalyzeConversationAsync and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new { id = "", participantId = "", + text = "", }, }, parameters = new @@ -24,7 +64,6 @@ using RequestContent content = RequestContent.Create(new projectName = "", deploymentName = "", }, - kind = "Conversation", }); Response response = await client.AnalyzeConversationAsync(content); @@ -33,12 +72,13 @@ Console.WriteLine(result.GetProperty("kind").ToString()); ]]> This sample shows how to call AnalyzeConversationAsync with all request content and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new @@ -47,7 +87,8 @@ using RequestContent content = RequestContent.Create(new participantId = "", language = "", modality = "transcript", - role = "agent", + role = "customer", + text = "", }, }, parameters = new @@ -56,28 +97,27 @@ using RequestContent content = RequestContent.Create(new deploymentName = "", verbose = true, isLoggingEnabled = true, - stringIndexType = "Utf16CodeUnit", + stringIndexType = "TextElements_v8", directTarget = "", targetProjectParameters = new { key = new { + targetProjectKind = "Luis", query = "", callingOptions = new Dictionary { ["verbose"] = true, ["log"] = true, ["show-all-intents"] = true, - ["timezoneOffset"] = 123.45F, + ["timezoneOffset"] = 1234, ["spellCheck"] = true, ["bing-spell-check-subscription-key"] = "" }, - targetProjectKind = "Luis", apiVersion = "", }, }, }, - kind = "Conversation", }); Response response = await client.AnalyzeConversationAsync(content); @@ -89,18 +129,20 @@ Console.WriteLine(result.GetProperty("kind").ToString()); This sample shows how to call AnalyzeConversation and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new { id = "", participantId = "", + text = "", }, }, parameters = new @@ -108,7 +150,6 @@ using RequestContent content = RequestContent.Create(new projectName = "", deploymentName = "", }, - kind = "Conversation", }); Response response = client.AnalyzeConversation(content); @@ -117,12 +158,13 @@ Console.WriteLine(result.GetProperty("kind").ToString()); ]]> This sample shows how to call AnalyzeConversation with all request content and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new @@ -131,7 +173,8 @@ using RequestContent content = RequestContent.Create(new participantId = "", language = "", modality = "transcript", - role = "agent", + role = "customer", + text = "", }, }, parameters = new @@ -140,28 +183,27 @@ using RequestContent content = RequestContent.Create(new deploymentName = "", verbose = true, isLoggingEnabled = true, - stringIndexType = "Utf16CodeUnit", + stringIndexType = "TextElements_v8", directTarget = "", targetProjectParameters = new { key = new { + targetProjectKind = "Luis", query = "", callingOptions = new Dictionary { ["verbose"] = true, ["log"] = true, ["show-all-intents"] = true, - ["timezoneOffset"] = 123.45F, + ["timezoneOffset"] = 1234, ["spellCheck"] = true, ["bing-spell-check-subscription-key"] = "" }, - targetProjectKind = "Luis", apiVersion = "", }, }, }, - kind = "Conversation", }); Response response = client.AnalyzeConversation(content); @@ -169,50 +211,73 @@ JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("kind").ToString()); ]]> - + + +This sample shows how to call AnalyzeConversationOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> +This sample shows how to call AnalyzeConversationOperationStatusAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); +]]> + + -This sample shows how to call GetAnalyzeConversationJobStatusAsync and parse the result. +This sample shows how to call AnalyzeConversationOperationStatus. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> +This sample shows how to call AnalyzeConversationOperationStatus with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); +]]> + + + +This sample shows how to call AnalyzeConversationOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -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()); 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 GetAnalyzeConversationJobStatusAsync with all parameters and parse the result. +This sample shows how to call AnalyzeConversationOperationStatusAsync with all parameters and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); +Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -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()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); Console.WriteLine(result.GetProperty("displayName").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); @@ -222,64 +287,57 @@ Console.WriteLine(result.GetProperty("status").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("nextLink").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()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); ]]> - + -This sample shows how to call GetAnalyzeConversationJobStatus and parse the result. +This sample shows how to call AnalyzeConversationOperationStatus and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -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()); 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 GetAnalyzeConversationJobStatus with all parameters and parse the result. +This sample shows how to call AnalyzeConversationOperationStatus with all parameters and parse the result. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); +Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -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()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); Console.WriteLine(result.GetProperty("displayName").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); @@ -289,25 +347,153 @@ Console.WriteLine(result.GetProperty("status").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("nextLink").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()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); +]]> + + + +This sample shows how to call AnalyzeConversationSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] +{ + new TextConversation("", "", new TextConversationItem[] + { + new TextConversationItem("", "", "") + }) +}); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction() +}); +]]> +This sample shows how to call AnalyzeConversationSubmitOperationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] +{ + new TextConversation("", "", new TextConversationItem[] + { + new TextConversationItem("", "", "") + { + Language = "", + Modality = InputModality.Transcript, + Role = ParticipantRole.Customer, + } + }) + { + Domain = ConversationDomain.Finance, + } +}); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + LoggingOptOut = true, + ModelVersion = "", + PiiCategories = {ConversationPiiCategories.Address}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + RedactionCharacter = RedactionCharacter.ExclamationPoint, + ExcludePiiCategories = {ConversationPiiCategoryExclusions.Address}, + }, + Name = "", + } +}, displayName: ""); +]]> + + + +This sample shows how to call AnalyzeConversationSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] +{ + new TextConversation("", "", new TextConversationItem[] + { + new TextConversationItem("", "", "") + }) +}); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction() +}); +]]> +This sample shows how to call AnalyzeConversationSubmitOperation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + +MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] +{ + new TextConversation("", "", new TextConversationItem[] + { + new TextConversationItem("", "", "") + { + Language = "", + Modality = InputModality.Transcript, + Role = ParticipantRole.Customer, + } + }) + { + Domain = ConversationDomain.Finance, + } +}); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] +{ + new PiiOperationAction + { + ActionContent = new ConversationPiiActionContent + { + LoggingOptOut = true, + ModelVersion = "", + PiiCategories = {ConversationPiiCategories.Address}, + RedactAudioTiming = true, + RedactionSource = TranscriptContentType.Lexical, + RedactionCharacter = RedactionCharacter.ExclamationPoint, + ExcludePiiCategories = {ConversationPiiCategoryExclusions.Address}, + }, + Name = "", + } +}, displayName: ""); ]]> - + -This sample shows how to call AnalyzeConversationsAsync and parse the result. +This sample shows how to call AnalyzeConversationSubmitOperationAsync. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -319,18 +505,18 @@ using RequestContent content = RequestContent.Create(new { new { + modality = "text", conversationItems = new object[] { new { - text = "", id = "", participantId = "", + text = "", } }, id = "", language = "", - modality = "text", } }, }, @@ -338,26 +524,15 @@ using RequestContent content = RequestContent.Create(new { new { - kind = "ConversationalSummarizationTask", + kind = "ConversationalPIITask", } }, }); -Operation operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -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()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); ]]> -This sample shows how to call AnalyzeConversationsAsync with all parameters and request content and parse the result. +This sample shows how to call AnalyzeConversationSubmitOperationAsync with all parameters and request content. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -370,21 +545,21 @@ using RequestContent content = RequestContent.Create(new { new { + modality = "text", conversationItems = new object[] { new { - text = "", id = "", participantId = "", language = "", modality = "transcript", - role = "agent", + role = "customer", + text = "", } }, id = "", language = "", - modality = "text", domain = "finance", } }, @@ -393,69 +568,35 @@ using RequestContent content = RequestContent.Create(new { new { + kind = "ConversationalPIITask", parameters = new { - summaryAspects = new object[] + loggingOptOut = true, + modelVersion = "", + piiCategories = new object[] { - "issue" + "Address" + }, + redactAudioTiming = true, + redactionSource = "lexical", + redactionCharacter = "!", + excludePiiCategories = new object[] + { + "Address" }, - sentenceCount = 1234, - stringIndexType = "Utf16CodeUnit", - modelVersion = "", - loggingOptOut = true, }, - kind = "ConversationalSummarizationTask", taskName = "", } }, }); -Operation operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -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()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); -Console.WriteLine(result.GetProperty("displayName").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("nextLink").ToString()); +Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); ]]> - + -This sample shows how to call AnalyzeConversations and parse the result. +This sample shows how to call AnalyzeConversationSubmitOperation. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -467,18 +608,18 @@ using RequestContent content = RequestContent.Create(new { new { + modality = "text", conversationItems = new object[] { new { - text = "", id = "", participantId = "", + text = "", } }, id = "", language = "", - modality = "text", } }, }, @@ -486,26 +627,15 @@ using RequestContent content = RequestContent.Create(new { new { - kind = "ConversationalSummarizationTask", + kind = "ConversationalPIITask", } }, }); -Operation operation = client.AnalyzeConversations(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -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()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); ]]> -This sample shows how to call AnalyzeConversations with all parameters and request content and parse the result. +This sample shows how to call AnalyzeConversationSubmitOperation with all parameters and request content. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -518,21 +648,21 @@ using RequestContent content = RequestContent.Create(new { new { + modality = "text", conversationItems = new object[] { new { - text = "", id = "", participantId = "", language = "", modality = "transcript", - role = "agent", + role = "customer", + text = "", } }, id = "", language = "", - modality = "text", domain = "finance", } }, @@ -541,100 +671,66 @@ using RequestContent content = RequestContent.Create(new { new { + kind = "ConversationalPIITask", parameters = new { - summaryAspects = new object[] + loggingOptOut = true, + modelVersion = "", + piiCategories = new object[] { - "issue" + "Address" + }, + redactAudioTiming = true, + redactionSource = "lexical", + redactionCharacter = "!", + excludePiiCategories = new object[] + { + "Address" }, - sentenceCount = 1234, - stringIndexType = "Utf16CodeUnit", - modelVersion = "", - loggingOptOut = true, }, - kind = "ConversationalSummarizationTask", taskName = "", } }, }); -Operation operation = client.AnalyzeConversations(WaitUntil.Completed, content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -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()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); -Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); -Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); -Console.WriteLine(result.GetProperty("displayName").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("nextLink").ToString()); +Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); ]]> - + -This sample shows how to call CancelAnalyzeConversationsAsync. +This sample shows how to call AnalyzeConversationCancelOperationAsync. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Operation operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +Operation operation = await client.AnalyzeConversationCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); ]]> -This sample shows how to call CancelAnalyzeConversationsAsync with all parameters. +This sample shows how to call AnalyzeConversationCancelOperationAsync with all parameters. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Operation operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +Operation operation = await client.AnalyzeConversationCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); ]]> - + -This sample shows how to call CancelAnalyzeConversations. +This sample shows how to call AnalyzeConversationCancelOperation. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Operation operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +Operation operation = client.AnalyzeConversationCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); ]]> -This sample shows how to call CancelAnalyzeConversations with all parameters. +This sample shows how to call AnalyzeConversationCancelOperation with all parameters. "); +Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); -Operation operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +Operation operation = client.AnalyzeConversationCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); ]]> diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAuthoringClient.xml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAuthoringClient.xml deleted file mode 100644 index bd038fdfaf70f..0000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Docs/ConversationAuthoringClient.xml +++ /dev/null @@ -1,3061 +0,0 @@ - - - - - -This sample shows how to call CreateProjectAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectKind = "Conversation", - projectName = "", - language = "", -}); -Response response = await client.CreateProjectAsync("", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> -This sample shows how to call CreateProjectAsync with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", -}); -Response response = await client.CreateProjectAsync("", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> - - - -This sample shows how to call CreateProject and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectKind = "Conversation", - projectName = "", - language = "", -}); -Response response = client.CreateProject("", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> -This sample shows how to call CreateProject with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", -}); -Response response = client.CreateProject("", content); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> - - - -This sample shows how to call GetProjectAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetProjectAsync(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> -This sample shows how to call GetProjectAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetProjectAsync(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> - - - -This sample shows how to call GetProject and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetProject(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> -This sample shows how to call GetProject with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetProject(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("projectKind").ToString()); -Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); -Console.WriteLine(result.GetProperty("projectName").ToString()); -Console.WriteLine(result.GetProperty("multilingual").ToString()); -Console.WriteLine(result.GetProperty("description").ToString()); -Console.WriteLine(result.GetProperty("language").ToString()); -]]> - - - -This sample shows how to call GetDeploymentAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetDeploymentAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> -This sample shows how to call GetDeploymentAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetDeploymentAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> - - - -This sample shows how to call GetDeployment and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetDeployment("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> -This sample shows how to call GetDeployment with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetDeployment("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> - - - -This sample shows how to call GetDeploymentJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetDeploymentJobStatusAsync("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetDeploymentJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetDeploymentJobStatusAsync("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetDeploymentJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetDeploymentJobStatus("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetDeploymentJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetDeploymentJobStatus("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetSwapDeploymentsJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetSwapDeploymentsJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetSwapDeploymentsJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetSwapDeploymentsJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetSwapDeploymentsJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetSwapDeploymentsJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetSwapDeploymentsJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetSwapDeploymentsJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetExportProjectJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetExportProjectJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetExportProjectJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetExportProjectJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("resultUrl").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetExportProjectJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetExportProjectJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetExportProjectJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetExportProjectJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("resultUrl").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetImportProjectJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetImportProjectJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetImportProjectJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetImportProjectJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetImportProjectJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetImportProjectJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetImportProjectJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetImportProjectJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetTrainedModelAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetTrainedModelAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("label").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); -Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -]]> -This sample shows how to call GetTrainedModelAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetTrainedModelAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("label").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); -Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -]]> - - - -This sample shows how to call GetTrainedModel and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetTrainedModel("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("label").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); -Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -]]> -This sample shows how to call GetTrainedModel with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetTrainedModel("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("label").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); -Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -]]> - - - -This sample shows how to call DeleteTrainedModelAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.DeleteTrainedModelAsync("", ""); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call DeleteTrainedModelAsync with all parameters. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.DeleteTrainedModelAsync("", ""); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call DeleteTrainedModel. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.DeleteTrainedModel("", ""); - -Console.WriteLine(response.Status); -]]> -This sample shows how to call DeleteTrainedModel with all parameters. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.DeleteTrainedModel("", ""); - -Console.WriteLine(response.Status); -]]> - - - -This sample shows how to call GetModelEvaluationSummaryAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetModelEvaluationSummaryAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); -]]> -This sample shows how to call GetModelEvaluationSummaryAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetModelEvaluationSummaryAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); -Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("trainingSplitPercentage").ToString()); -Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("testingSplitPercentage").ToString()); -]]> - - - -This sample shows how to call GetModelEvaluationSummary and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetModelEvaluationSummary("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); -]]> -This sample shows how to call GetModelEvaluationSummary with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetModelEvaluationSummary("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); -Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); -Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("kind").ToString()); -Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("trainingSplitPercentage").ToString()); -Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("testingSplitPercentage").ToString()); -]]> - - - -This sample shows how to call GetLoadSnapshotJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetLoadSnapshotJobStatusAsync("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetLoadSnapshotJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetLoadSnapshotJobStatusAsync("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetLoadSnapshotJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetLoadSnapshotJobStatus("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetLoadSnapshotJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetLoadSnapshotJobStatus("", "", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetTrainingJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetTrainingJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetTrainingJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetTrainingJobStatusAsync("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetTrainingJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetTrainingJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetTrainingJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetTrainingJobStatus("", ""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetProjectDeletionJobStatusAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetProjectDeletionJobStatusAsync(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetProjectDeletionJobStatusAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = await client.GetProjectDeletionJobStatusAsync(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetProjectDeletionJobStatus and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetProjectDeletionJobStatus(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call GetProjectDeletionJobStatus with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Response response = client.GetProjectDeletionJobStatus(""); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call GetProjectsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetProjectsAsync()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); -} -]]> -This sample shows how to call GetProjectsAsync with all request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetProjectsAsync()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); -} -]]> - - - -This sample shows how to call GetProjects and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetProjects()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); -} -]]> -This sample shows how to call GetProjects with all request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetProjects()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); -} -]]> - - - -This sample shows how to call GetDeploymentsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetDeploymentsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -} -]]> -This sample shows how to call GetDeploymentsAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetDeploymentsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -} -]]> - - - -This sample shows how to call GetDeployments and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetDeployments("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -} -]]> -This sample shows how to call GetDeployments with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetDeployments("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -} -]]> - - - -This sample shows how to call GetTrainedModelsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetTrainedModelsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -} -]]> -This sample shows how to call GetTrainedModelsAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetTrainedModelsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -} -]]> - - - -This sample shows how to call GetTrainedModels and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetTrainedModels("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -} -]]> -This sample shows how to call GetTrainedModels with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetTrainedModels("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); -} -]]> - - - -This sample shows how to call GetModelEvaluationResultsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetModelEvaluationResultsAsync("", "")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); -} -]]> -This sample shows how to call GetModelEvaluationResultsAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetModelEvaluationResultsAsync("", "", stringIndexType: "Utf16CodeUnit")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); -} -]]> - - - -This sample shows how to call GetModelEvaluationResults and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetModelEvaluationResults("", "")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); -} -]]> -This sample shows how to call GetModelEvaluationResults with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetModelEvaluationResults("", "", stringIndexType: "Utf16CodeUnit")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); -} -]]> - - - -This sample shows how to call GetTrainingJobsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetTrainingJobsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); -} -]]> -This sample shows how to call GetTrainingJobsAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetTrainingJobsAsync("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -} -]]> - - - -This sample shows how to call GetTrainingJobs and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetTrainingJobs("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); -} -]]> -This sample shows how to call GetTrainingJobs with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetTrainingJobs("")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -} -]]> - - - -This sample shows how to call GetSupportedLanguagesAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetSupportedLanguagesAsync("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} -]]> -This sample shows how to call GetSupportedLanguagesAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetSupportedLanguagesAsync("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} -]]> - - - -This sample shows how to call GetSupportedLanguages and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetSupportedLanguages("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} -]]> -This sample shows how to call GetSupportedLanguages with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetSupportedLanguages("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); -} -]]> - - - -This sample shows how to call GetSupportedPrebuiltEntitiesAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetSupportedPrebuiltEntitiesAsync()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); -} -]]> -This sample shows how to call GetSupportedPrebuiltEntitiesAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetSupportedPrebuiltEntitiesAsync(language: "", multilingual: true)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); -} -]]> - - - -This sample shows how to call GetSupportedPrebuiltEntities and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetSupportedPrebuiltEntities()) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); -} -]]> -This sample shows how to call GetSupportedPrebuiltEntities with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetSupportedPrebuiltEntities(language: "", multilingual: true)) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); -} -]]> - - - -This sample shows how to call GetTrainingConfigVersionsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} -]]> -This sample shows how to call GetTrainingConfigVersionsAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} -]]> - - - -This sample shows how to call GetTrainingConfigVersions and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetTrainingConfigVersions("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} -]]> -This sample shows how to call GetTrainingConfigVersions with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -foreach (BinaryData item in client.GetTrainingConfigVersions("Conversation")) -{ - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); -} -]]> - - - -This sample shows how to call DeleteProjectAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.DeleteProjectAsync(WaitUntil.Completed, ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call DeleteProjectAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.DeleteProjectAsync(WaitUntil.Completed, ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call DeleteProject and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.DeleteProject(WaitUntil.Completed, ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call DeleteProject with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.DeleteProject(WaitUntil.Completed, ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call ExportProjectAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.ExportProjectAsync(WaitUntil.Completed, ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call ExportProjectAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.ExportProjectAsync(WaitUntil.Completed, "", exportedProjectFormat: "Conversation", assetKind: "", stringIndexType: "Utf16CodeUnit", trainedModelLabel: ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("resultUrl").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call ExportProject and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.ExportProject(WaitUntil.Completed, ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call ExportProject with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.ExportProject(WaitUntil.Completed, "", exportedProjectFormat: "Conversation", assetKind: "", stringIndexType: "Utf16CodeUnit", trainedModelLabel: ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("resultUrl").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call ImportProjectAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - projectName = "", - language = "", - }, -}); -Operation operation = await client.ImportProjectAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call ImportProjectAsync with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", - }, - assets = new - { - intents = new object[] - { - new - { - category = "", - } - }, - entities = new object[] - { - new - { - category = "", - compositionSetting = "returnLongestOverlap", - list = new - { - sublists = new object[] - { - new - { - listKey = "", - synonyms = new object[] - { - new - { - language = "", - values = new object[] - { - "" - }, - } - }, - } - }, - }, - prebuilts = new object[] - { - new - { - category = "", - } - }, - regex = new - { - expressions = new object[] - { - new - { - regexKey = "", - language = "", - regexPattern = "", - } - }, - }, - requiredComponents = new object[] - { - "" - }, - } - }, - utterances = new object[] - { - new - { - entities = new object[] - { - new - { - category = "", - offset = 1234, - length = 1234, - } - }, - text = "", - language = "", - intent = "", - dataset = "", - } - }, - projectKind = "Conversation", - }, -}); -Operation operation = await client.ImportProjectAsync(WaitUntil.Completed, "", content, exportedProjectFormat: "Conversation"); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call ImportProject and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - projectName = "", - language = "", - }, -}); -Operation operation = client.ImportProject(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call ImportProject with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", - }, - assets = new - { - intents = new object[] - { - new - { - category = "", - } - }, - entities = new object[] - { - new - { - category = "", - compositionSetting = "returnLongestOverlap", - list = new - { - sublists = new object[] - { - new - { - listKey = "", - synonyms = new object[] - { - new - { - language = "", - values = new object[] - { - "" - }, - } - }, - } - }, - }, - prebuilts = new object[] - { - new - { - category = "", - } - }, - regex = new - { - expressions = new object[] - { - new - { - regexKey = "", - language = "", - regexPattern = "", - } - }, - }, - requiredComponents = new object[] - { - "" - }, - } - }, - utterances = new object[] - { - new - { - entities = new object[] - { - new - { - category = "", - offset = 1234, - length = 1234, - } - }, - text = "", - language = "", - intent = "", - dataset = "", - } - }, - projectKind = "Conversation", - }, -}); -Operation operation = client.ImportProject(WaitUntil.Completed, "", content, exportedProjectFormat: "Conversation"); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call TrainAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", - trainingMode = "advanced", -}); -Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call TrainAsync with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", - trainingConfigVersion = "", - trainingMode = "advanced", - evaluationOptions = new - { - kind = "percentage", - trainingSplitPercentage = 1234, - testingSplitPercentage = 1234, - }, -}); -Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call Train and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", - trainingMode = "advanced", -}); -Operation operation = client.Train(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call Train with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - modelLabel = "", - trainingConfigVersion = "", - trainingMode = "advanced", - evaluationOptions = new - { - kind = "percentage", - trainingSplitPercentage = 1234, - testingSplitPercentage = 1234, - }, -}); -Operation operation = client.Train(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call SwapDeploymentsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - firstDeploymentName = "", - secondDeploymentName = "", -}); -Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call SwapDeploymentsAsync with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - firstDeploymentName = "", - secondDeploymentName = "", -}); -Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call SwapDeployments and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - firstDeploymentName = "", - secondDeploymentName = "", -}); -Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call SwapDeployments with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - firstDeploymentName = "", - secondDeploymentName = "", -}); -Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call DeployProjectAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - trainedModelLabel = "", -}); -Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> -This sample shows how to call DeployProjectAsync with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - trainedModelLabel = "", -}); -Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> - - - -This sample shows how to call DeployProject and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - trainedModelLabel = "", -}); -Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> -This sample shows how to call DeployProject with all parameters and request content and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -using RequestContent content = RequestContent.Create(new -{ - trainedModelLabel = "", -}); -Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("deploymentName").ToString()); -Console.WriteLine(result.GetProperty("modelId").ToString()); -Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); -Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); -Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); -]]> - - - -This sample shows how to call DeleteDeploymentAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call DeleteDeploymentAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call DeleteDeployment and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call DeleteDeployment with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call LoadSnapshotAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.LoadSnapshotAsync(WaitUntil.Completed, "", ""); -]]> -This sample shows how to call LoadSnapshotAsync with all parameters. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.LoadSnapshotAsync(WaitUntil.Completed, "", ""); -]]> - - - -This sample shows how to call LoadSnapshot. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.LoadSnapshot(WaitUntil.Completed, "", ""); -]]> -This sample shows how to call LoadSnapshot with all parameters. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.LoadSnapshot(WaitUntil.Completed, "", ""); -]]> - - - -This sample shows how to call CancelTrainingJobAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.CancelTrainingJobAsync(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call CancelTrainingJobAsync with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = await client.CancelTrainingJobAsync(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - -This sample shows how to call CancelTrainingJob and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.CancelTrainingJob(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -]]> -This sample shows how to call CancelTrainingJob with all parameters and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - -Operation operation = client.CancelTrainingJob(WaitUntil.Completed, "", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); -Console.WriteLine(result.GetProperty("jobId").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); -Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); -Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); -]]> - - - \ No newline at end of file diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 0000000000000..dca28b5a6b70f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/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.Conversations +{ + 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.Conversations/src/Generated/Internal/ChangeTrackingList.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 0000000000000..59e13aea02ff0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/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.Conversations +{ + 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.Conversations/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 0000000000000..d84b4206c61c6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/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.Conversations +{ + 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.Conversations/src/Generated/Internal/Optional.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/Optional.cs new file mode 100644 index 0000000000000..a54d07965ccfe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/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.Conversations +{ + 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.Conversations/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 0000000000000..8cbe28a38718b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/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.Conversations +{ + 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.Conversations/src/Generated/Models/AgeResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeResolution.Serialization.cs new file mode 100644 index 0000000000000..d85f9700bf475 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class AgeResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgeResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + AgeResolution 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(AgeResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgeResolution(document.RootElement, options); + } + + internal static AgeResolution DeserializeAgeResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + AgeUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new AgeUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgeResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgeResolution)} does not support writing '{options.Format}' format."); + } + } + + AgeResolution 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 DeserializeAgeResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgeResolution)} 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 AgeResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAgeResolution(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.Conversations/src/Generated/Models/AgeResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeResolution.cs new file mode 100644 index 0000000000000..fbd969237e0e9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the Age entity resolution model. + public partial class AgeResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The Age Unit of measurement. + internal AgeResolution(double value, AgeUnit unit) + { + ResolutionKind = ResolutionKind.AgeResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The Age Unit of measurement. + internal AgeResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, AgeUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal AgeResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The Age Unit of measurement. + public AgeUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeUnit.cs new file mode 100644 index 0000000000000..b07e4fcd7a5c2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AgeUnit.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The Age Unit of measurement. + public readonly partial struct AgeUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgeUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string YearValue = "Year"; + private const string MonthValue = "Month"; + private const string WeekValue = "Week"; + private const string DayValue = "Day"; + + /// Unspecified age unit. + public static AgeUnit Unspecified { get; } = new AgeUnit(UnspecifiedValue); + /// Year age unit. + public static AgeUnit Year { get; } = new AgeUnit(YearValue); + /// Month age unit. + public static AgeUnit Month { get; } = new AgeUnit(MonthValue); + /// Week age unit. + public static AgeUnit Week { get; } = new AgeUnit(WeekValue); + /// Day age unit. + public static AgeUnit Day { get; } = new AgeUnit(DayValue); + /// Determines if two values are the same. + public static bool operator ==(AgeUnit left, AgeUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgeUnit left, AgeUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AgeUnit(string value) => new AgeUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgeUnit other && Equals(other); + /// + public bool Equals(AgeUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.Serialization.cs new file mode 100644 index 0000000000000..318d0251cb180 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.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.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownAnalysisConfig))] + internal partial class AnalysisConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalysisConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + 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 + } + } + writer.WriteEndObject(); + } + + AnalysisConfig 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(AnalysisConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisConfig(document.RootElement, options); + } + + internal static AnalysisConfig DeserializeAnalysisConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("targetProjectKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Conversation": return ConversationConfig.DeserializeConversationConfig(element, options); + case "Luis": return LuisConfig.DeserializeLuisConfig(element, options); + case "QuestionAnswering": return QuestionAnsweringConfig.DeserializeQuestionAnsweringConfig(element, options); + } + } + return UnknownAnalysisConfig.DeserializeUnknownAnalysisConfig(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(AnalysisConfig)} does not support writing '{options.Format}' format."); + } + } + + AnalysisConfig 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 DeserializeAnalysisConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalysisConfig)} 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 AnalysisConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalysisConfig(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.Conversations/src/Generated/Models/AnalysisConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.cs new file mode 100644 index 0000000000000..9b9c73517149a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalysisConfig.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.Conversations.Models +{ + /// + /// This is the parameter set of either the Orchestration project itself or one of the target services. + /// 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 AnalysisConfig + { + /// + /// 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 AnalysisConfig() + { + } + + /// Initializes a new instance of . + /// The type of a target service. + /// The API version to use when call a specific target service. + /// Keeps track of any properties unknown to the library. + internal AnalysisConfig(TargetProjectKind targetProjectKind, string apiVersion, IDictionary serializedAdditionalRawData) + { + TargetProjectKind = targetProjectKind; + ApiVersion = apiVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of a target service. + internal TargetProjectKind TargetProjectKind { get; set; } + /// The API version to use when call a specific target service. + public string ApiVersion { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.Serialization.cs new file mode 100644 index 0000000000000..c503617113069 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeConversationActionResult))] + public partial class AnalyzeConversationActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationActionResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationActionResult 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(AnalyzeConversationActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationActionResult(document.RootElement, options); + } + + internal static AnalyzeConversationActionResult DeserializeAnalyzeConversationActionResult(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 "ConversationResult": return ConversationActionResult.DeserializeConversationActionResult(element, options); + } + } + return UnknownAnalyzeConversationActionResult.DeserializeUnknownAnalyzeConversationActionResult(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(AnalyzeConversationActionResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationActionResult 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 DeserializeAnalyzeConversationActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationActionResult)} 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 AnalyzeConversationActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationActionResult(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.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.cs new file mode 100644 index 0000000000000..bebd1c06e0730 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationActionResult.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.Conversations.Models +{ + /// + /// The base class of a conversation input task result. + /// 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 AnalyzeConversationActionResult + { + /// + /// 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 AnalyzeConversationActionResult() + { + } + + /// Initializes a new instance of . + /// The base class of a conversation input task result. + /// Keeps track of any properties unknown to the library. + internal AnalyzeConversationActionResult(AnalyzeConversationResultKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The base class of a conversation input task result. + internal AnalyzeConversationResultKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.Serialization.cs new file mode 100644 index 0000000000000..8b3092fc518de --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeConversationInput))] + internal partial class AnalyzeConversationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationInput 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(AnalyzeConversationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationInput(document.RootElement, options); + } + + internal static AnalyzeConversationInput DeserializeAnalyzeConversationInput(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 "Conversation": return ConversationalInput.DeserializeConversationalInput(element, options); + } + } + return UnknownAnalyzeConversationInput.DeserializeUnknownAnalyzeConversationInput(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(AnalyzeConversationInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationInput 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 DeserializeAnalyzeConversationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationInput)} 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 AnalyzeConversationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationInput(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.Conversations/src/Generated/Models/AnalyzeConversationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.cs new file mode 100644 index 0000000000000..3857ca434df7d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInput.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.Conversations.Models +{ + /// + /// The base class of a conversation input 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 . + /// + internal abstract partial class AnalyzeConversationInput + { + /// + /// 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 AnalyzeConversationInput() + { + } + + /// Initializes a new instance of . + /// The base class of a conversation input task. + /// Keeps track of any properties unknown to the library. + internal AnalyzeConversationInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The base class of a conversation input task. + internal AnalyzeConversationInputKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.cs new file mode 100644 index 0000000000000..66074fdfd0b71 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationInputKind.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.Conversations.Models +{ + /// Enumeration of supported Conversation tasks. + public readonly partial struct AnalyzeConversationInputKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeConversationInputKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConversationValue = "Conversation"; + + /// Conversation task kind. + public static AnalyzeConversationInputKind Conversation { get; } = new AnalyzeConversationInputKind(ConversationValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeConversationInputKind left, AnalyzeConversationInputKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeConversationInputKind left, AnalyzeConversationInputKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeConversationInputKind(string value) => new AnalyzeConversationInputKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeConversationInputKind other && Equals(other); + /// + public bool Equals(AnalyzeConversationInputKind 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.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..ede5acdcf722e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.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.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeConversationOperationAction))] + public partial class AnalyzeConversationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationOperationAction 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(AnalyzeConversationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationOperationAction(document.RootElement, options); + } + + internal static AnalyzeConversationOperationAction DeserializeAnalyzeConversationOperationAction(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 "ConversationalPIITask": return PiiOperationAction.DeserializePiiOperationAction(element, options); + case "ConversationalSummarizationTask": return SummarizationOperationAction.DeserializeSummarizationOperationAction(element, options); + case "CustomConversationalSummarizationTask": return CustomSummarizationOperationAction.DeserializeCustomSummarizationOperationAction(element, options); + } + } + return UnknownAnalyzeConversationOperationAction.DeserializeUnknownAnalyzeConversationOperationAction(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(AnalyzeConversationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationOperationAction 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 DeserializeAnalyzeConversationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationOperationAction)} 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 AnalyzeConversationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationOperationAction(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.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.cs new file mode 100644 index 0000000000000..cf0956a870339 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationAction.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.Conversations.Models +{ + /// + /// Base class for a long-running conversation input task. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class AnalyzeConversationOperationAction + { + /// + /// 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 AnalyzeConversationOperationAction() + { + } + + /// Initializes a new instance of . + /// task name. + /// Enumeration of supported analysis tasks on a collection of conversations. + /// Keeps track of any properties unknown to the library. + internal AnalyzeConversationOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData) + { + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// task name. + public string Name { get; set; } + /// Enumeration of supported analysis tasks on a collection of conversations. + internal AnalyzeConversationOperationActionKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationActionKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationActionKind.cs new file mode 100644 index 0000000000000..c2b76ef76ad37 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationActionKind.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.Conversations.Models +{ + /// Enumeration of supported analysis tasks on a collection of conversations. + internal readonly partial struct AnalyzeConversationOperationActionKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeConversationOperationActionKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConversationalSummarizationTaskValue = "ConversationalSummarizationTask"; + private const string ConversationalPIITaskValue = "ConversationalPIITask"; + private const string CustomConversationalSummarizationTaskValue = "CustomConversationalSummarizationTask"; + + /// Conversational Summarization Task. + public static AnalyzeConversationOperationActionKind ConversationalSummarizationTask { get; } = new AnalyzeConversationOperationActionKind(ConversationalSummarizationTaskValue); + /// Conversational PII Task. + public static AnalyzeConversationOperationActionKind ConversationalPIITask { get; } = new AnalyzeConversationOperationActionKind(ConversationalPIITaskValue); + /// Custom Conversational Summarization Task. + public static AnalyzeConversationOperationActionKind CustomConversationalSummarizationTask { get; } = new AnalyzeConversationOperationActionKind(CustomConversationalSummarizationTaskValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeConversationOperationActionKind left, AnalyzeConversationOperationActionKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeConversationOperationActionKind left, AnalyzeConversationOperationActionKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeConversationOperationActionKind(string value) => new AnalyzeConversationOperationActionKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeConversationOperationActionKind other && Equals(other); + /// + public bool Equals(AnalyzeConversationOperationActionKind 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.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs new file mode 100644 index 0000000000000..61879cd589ee0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.Serialization.cs @@ -0,0 +1,164 @@ +// 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.Conversations.Models +{ + internal partial class AnalyzeConversationOperationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationOperationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(ConversationInput, options); + writer.WritePropertyName("tasks"u8); + writer.WriteStartArray(); + foreach (var item in Actions) + { + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationOperationInput 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(AnalyzeConversationOperationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationOperationInput(document.RootElement, options); + } + + internal static AnalyzeConversationOperationInput DeserializeAnalyzeConversationOperationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + MultiLanguageConversationInput analysisInput = default; + IList tasks = 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 = MultiLanguageConversationInput.DeserializeMultiLanguageConversationInput(property.Value, options); + continue; + } + if (property.NameEquals("tasks"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeConversationOperationAction.DeserializeAnalyzeConversationOperationAction(item, options)); + } + tasks = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeConversationOperationInput(displayName, analysisInput, tasks, 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(AnalyzeConversationOperationInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationOperationInput 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 DeserializeAnalyzeConversationOperationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationOperationInput)} 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 AnalyzeConversationOperationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationOperationInput(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.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs new file mode 100644 index 0000000000000..f95b94d7f28c9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationInput.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Conversations.Models +{ + /// It is a wrap up a Question Answering KB response. + internal partial class AnalyzeConversationOperationInput + { + /// + /// 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 . + /// Analysis Input. + /// + /// Set of tasks to execute on the input conversation. + /// 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 AnalyzeConversationOperationInput(MultiLanguageConversationInput conversationInput, IEnumerable actions) + { + Argument.AssertNotNull(conversationInput, nameof(conversationInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + ConversationInput = conversationInput; + Actions = actions.ToList(); + } + + /// Initializes a new instance of . + /// Display name for the analysis job. + /// Analysis Input. + /// + /// Set of tasks to execute on the input conversation. + /// 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 AnalyzeConversationOperationInput(string displayName, MultiLanguageConversationInput conversationInput, IList actions, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + ConversationInput = conversationInput; + Actions = actions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeConversationOperationInput() + { + } + + /// Display name for the analysis job. + public string DisplayName { get; set; } + /// Analysis Input. + public MultiLanguageConversationInput ConversationInput { get; } + /// + /// Set of tasks to execute on the input conversation. + /// 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; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..859cdee202d38 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeConversationOperationResult))] + public partial class AnalyzeConversationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationOperationResult 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(AnalyzeConversationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationOperationResult(document.RootElement, options); + } + + internal static AnalyzeConversationOperationResult DeserializeAnalyzeConversationOperationResult(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 "conversationalPIIResults": return ConversationPiiOperationResult.DeserializeConversationPiiOperationResult(element, options); + case "conversationalSummarizationResults": return SummarizationOperationResult.DeserializeSummarizationOperationResult(element, options); + case "customConversationalSummarizationResults": return CustomSummarizationOperationResult.DeserializeCustomSummarizationOperationResult(element, options); + } + } + return UnknownAnalyzeConversationOperationResult.DeserializeUnknownAnalyzeConversationOperationResult(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(AnalyzeConversationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationOperationResult 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 DeserializeAnalyzeConversationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationOperationResult)} 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 AnalyzeConversationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationOperationResult(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.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.cs new file mode 100644 index 0000000000000..40dbed2a34c8a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResult.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.Conversations.Models +{ + /// + /// Container for results of all tasks in the conversation job. + /// 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 AnalyzeConversationOperationResult + { + /// + /// 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 AnalyzeConversationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState 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. + /// discriminator kind. + /// Keeps track of any properties unknown to the library. + internal AnalyzeConversationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, string name, AnalyzeConversationOperationResultsKind kind, IDictionary serializedAdditionalRawData) + { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeConversationOperationResult() + { + } + + /// 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 ConversationActionState Status { get; } + /// task name. + public string Name { get; } + /// discriminator kind. + internal AnalyzeConversationOperationResultsKind Kind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResultsKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResultsKind.cs new file mode 100644 index 0000000000000..28dcf7ac0dcdf --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationResultsKind.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.Conversations.Models +{ + /// Enumeration of results for supported conversation analysis Results. + internal readonly partial struct AnalyzeConversationOperationResultsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeConversationOperationResultsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SummarizationOperationResultsValue = "conversationalSummarizationResults"; + private const string PiiOperationResultsValue = "conversationalPIIResults"; + private const string CustomSummarizationOperationResultsValue = "customConversationalSummarizationResults"; + + /// Conversational Summarization Results. + public static AnalyzeConversationOperationResultsKind SummarizationOperationResults { get; } = new AnalyzeConversationOperationResultsKind(SummarizationOperationResultsValue); + /// Conversational PII Results. + public static AnalyzeConversationOperationResultsKind PiiOperationResults { get; } = new AnalyzeConversationOperationResultsKind(PiiOperationResultsValue); + /// Custom Conversational Summarization Results. + public static AnalyzeConversationOperationResultsKind CustomSummarizationOperationResults { get; } = new AnalyzeConversationOperationResultsKind(CustomSummarizationOperationResultsValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeConversationOperationResultsKind left, AnalyzeConversationOperationResultsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeConversationOperationResultsKind left, AnalyzeConversationOperationResultsKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeConversationOperationResultsKind(string value) => new AnalyzeConversationOperationResultsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeConversationOperationResultsKind other && Equals(other); + /// + public bool Equals(AnalyzeConversationOperationResultsKind 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.Conversations/src/Generated/Models/AnalyzeConversationOperationState.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationState.Serialization.cs new file mode 100644 index 0000000000000..d198ea3450b00 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationState.Serialization.cs @@ -0,0 +1,258 @@ +// 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.Conversations.Models +{ + public partial class AnalyzeConversationOperationState : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationOperationState)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedDateTime, "O"); + if (Optional.IsDefined(ExpirationDateTime)) + { + writer.WritePropertyName("expirationDateTime"u8); + writer.WriteStringValue(ExpirationDateTime.Value, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + } + writer.WritePropertyName("lastUpdatedDateTime"u8); + writer.WriteStringValue(LastUpdatedDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("tasks"u8); + writer.WriteObjectValue(Actions, options); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationOperationState 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(AnalyzeConversationOperationState)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationOperationState(document.RootElement, options); + } + + internal static AnalyzeConversationOperationState DeserializeAnalyzeConversationOperationState(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; + ConversationActionState status = default; + IReadOnlyList errors = default; + string nextLink = default; + ConversationActions tasks = default; + ConversationRequestStatistics 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 ConversationActionState(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(ConversationError.DeserializeConversationError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("tasks"u8)) + { + tasks = ConversationActions.DeserializeConversationActions(property.Value, options); + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = ConversationRequestStatistics.DeserializeConversationRequestStatistics(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeConversationOperationState( + 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(AnalyzeConversationOperationState)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationOperationState 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 DeserializeAnalyzeConversationOperationState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationOperationState)} 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 AnalyzeConversationOperationState FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationOperationState(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.Conversations/src/Generated/Models/AnalyzeConversationOperationState.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationState.cs new file mode 100644 index 0000000000000..a01fb900a7501 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationOperationState.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.Conversations.Models +{ + /// Contains the status of the submitted job for analyzing a conversation, along with related statistics. + public partial class AnalyzeConversationOperationState + { + /// + /// 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. + /// Contains the state for the tasks that are being executed as part of the submitted job for analyzing a conversation. + /// is null. + internal AnalyzeConversationOperationState(DateTimeOffset createdDateTime, DateTimeOffset lastUpdatedDateTime, ConversationActionState status, ConversationActions actions) + { + Argument.AssertNotNull(actions, nameof(actions)); + + CreatedDateTime = createdDateTime; + LastUpdatedDateTime = lastUpdatedDateTime; + Status = status; + Errors = new ChangeTrackingList(); + Actions = actions; + } + + /// Initializes a new instance of . + /// display name. + /// Date and time job created. + /// Date and time job expires. + /// job ID. + /// last updated date and time. + /// status. + /// errors. + /// next link. + /// Contains the state for the tasks that are being executed as part of the submitted job for analyzing a conversation. + /// Contains the statistics for the submitted job. + /// Keeps track of any properties unknown to the library. + internal AnalyzeConversationOperationState(string displayName, DateTimeOffset createdDateTime, DateTimeOffset? expirationDateTime, Guid jobId, DateTimeOffset lastUpdatedDateTime, ConversationActionState status, IReadOnlyList errors, string nextLink, ConversationActions actions, ConversationRequestStatistics statistics, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + CreatedDateTime = createdDateTime; + ExpirationDateTime = expirationDateTime; + JobId = jobId; + LastUpdatedDateTime = lastUpdatedDateTime; + Status = status; + Errors = errors; + NextLink = nextLink; + Actions = actions; + Statistics = statistics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeConversationOperationState() + { + } + + /// 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 ConversationActionState Status { get; } + /// errors. + public IReadOnlyList Errors { get; } + /// next link. + public string NextLink { get; } + /// Contains the state for the tasks that are being executed as part of the submitted job for analyzing a conversation. + public ConversationActions Actions { get; } + /// Contains the statistics for the submitted job. + public ConversationRequestStatistics Statistics { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.Serialization.cs new file mode 100644 index 0000000000000..c0a489d8ccc5d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.Serialization.cs @@ -0,0 +1,154 @@ +// 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.Conversations.Models +{ + public partial class AnalyzeConversationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteStringValue(DetectedLanguage); + } + writer.WritePropertyName("prediction"u8); + writer.WriteObjectValue(Prediction, 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationResult 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(AnalyzeConversationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationResult(document.RootElement, options); + } + + internal static AnalyzeConversationResult DeserializeAnalyzeConversationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string query = default; + string detectedLanguage = default; + PredictionBase prediction = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + detectedLanguage = property.Value.GetString(); + continue; + } + if (property.NameEquals("prediction"u8)) + { + prediction = PredictionBase.DeserializePredictionBase(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeConversationResult(query, detectedLanguage, prediction, 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(AnalyzeConversationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationResult 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 DeserializeAnalyzeConversationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationResult)} 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 AnalyzeConversationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeConversationResult(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.Conversations/src/Generated/Models/AnalyzeConversationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.cs new file mode 100644 index 0000000000000..f0e17721934a5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents a conversation analysis response. + public partial class AnalyzeConversationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The conversation utterance given by the caller. + /// + /// The prediction result of a conversation project. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// or is null. + internal AnalyzeConversationResult(string query, PredictionBase prediction) + { + Argument.AssertNotNull(query, nameof(query)); + Argument.AssertNotNull(prediction, nameof(prediction)); + + Query = query; + Prediction = prediction; + } + + /// Initializes a new instance of . + /// The conversation utterance given by the caller. + /// The system detected language for the query in BCP 47 language representation.. + /// + /// The prediction result of a conversation project. + /// 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 AnalyzeConversationResult(string query, string detectedLanguage, PredictionBase prediction, IDictionary serializedAdditionalRawData) + { + Query = query; + DetectedLanguage = detectedLanguage; + Prediction = prediction; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeConversationResult() + { + } + + /// The conversation utterance given by the caller. + public string Query { get; } + /// The system detected language for the query in BCP 47 language representation.. + public string DetectedLanguage { get; } + /// + /// The prediction result of a conversation project. + /// 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 PredictionBase Prediction { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.cs new file mode 100644 index 0000000000000..a480138b66291 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnalyzeConversationResultKind.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.Conversations.Models +{ + /// Enumeration of supported conversational task results. + internal readonly partial struct AnalyzeConversationResultKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeConversationResultKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConversationResultValue = "ConversationResult"; + + /// Conversation result task kind. + public static AnalyzeConversationResultKind ConversationResult { get; } = new AnalyzeConversationResultKind(ConversationResultValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeConversationResultKind left, AnalyzeConversationResultKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeConversationResultKind left, AnalyzeConversationResultKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeConversationResultKind(string value) => new AnalyzeConversationResultKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeConversationResultKind other && Equals(other); + /// + public bool Equals(AnalyzeConversationResultKind 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.Conversations/src/Generated/Models/AnswerSpan.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswerSpan.Serialization.cs new file mode 100644 index 0000000000000..276783708f6e7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswerSpan.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class AnswerSpan : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnswerSpan)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(ConfidenceScore)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore.Value); + } + if (Optional.IsDefined(Offset)) + { + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset.Value); + } + if (Optional.IsDefined(Length)) + { + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length.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 + } + } + writer.WriteEndObject(); + } + + AnswerSpan 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(AnswerSpan)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnswerSpan(document.RootElement, options); + } + + internal static AnswerSpan DeserializeAnswerSpan(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + double? confidenceScore = default; + int? offset = default; + int? length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("offset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnswerSpan(text, confidenceScore, offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnswerSpan)} does not support writing '{options.Format}' format."); + } + } + + AnswerSpan 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 DeserializeAnswerSpan(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnswerSpan)} 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 AnswerSpan FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnswerSpan(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.Conversations/src/Generated/Models/AnswerSpan.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswerSpan.cs new file mode 100644 index 0000000000000..58e3e3c6ac3c5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswerSpan.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Answer span object of QnA. + public partial class AnswerSpan + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal AnswerSpan() + { + } + + /// Initializes a new instance of . + /// Predicted text of answer span. + /// Predicted score of answer span, value ranges from 0 to 1. + /// The answer span offset from the start of answer. + /// The length of the answer span. + /// Keeps track of any properties unknown to the library. + internal AnswerSpan(string text, double? confidenceScore, int? offset, int? length, IDictionary serializedAdditionalRawData) + { + Text = text; + ConfidenceScore = confidenceScore; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Predicted text of answer span. + public string Text { get; } + /// Predicted score of answer span, value ranges from 0 to 1. + public double? ConfidenceScore { get; } + /// The answer span offset from the start of answer. + public int? Offset { get; } + /// The length of the answer span. + public int? Length { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.Serialization.cs new file mode 100644 index 0000000000000..e6db51f2d350d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.Serialization.cs @@ -0,0 +1,152 @@ +// 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.Conversations.Models +{ + public partial class AnswersResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnswersResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Answers)) + { + writer.WritePropertyName("answers"u8); + writer.WriteStartArray(); + foreach (var item in Answers) + { + 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 + } + } + writer.WriteEndObject(); + } + + AnswersResult 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(AnswersResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnswersResult(document.RootElement, options); + } + + internal static AnswersResult DeserializeAnswersResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList answers = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("answers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KnowledgeBaseAnswer.DeserializeKnowledgeBaseAnswer(item, options)); + } + answers = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnswersResult(answers ?? 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(AnswersResult)} does not support writing '{options.Format}' format."); + } + } + + AnswersResult 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 DeserializeAnswersResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnswersResult)} 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 AnswersResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnswersResult(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.Conversations/src/Generated/Models/AnswersResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.cs new file mode 100644 index 0000000000000..1e18d4cb08bcb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AnswersResult.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.Conversations.Models +{ + /// Represents List of Question Answers. + public partial class AnswersResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal AnswersResult() + { + Answers = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Represents Answer Result list. + /// Keeps track of any properties unknown to the library. + internal AnswersResult(IReadOnlyList answers, IDictionary serializedAdditionalRawData) + { + Answers = answers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Represents Answer Result list. + public IReadOnlyList Answers { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.Serialization.cs new file mode 100644 index 0000000000000..60b00d27184c1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class AreaResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AreaResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + AreaResolution 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(AreaResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAreaResolution(document.RootElement, options); + } + + internal static AreaResolution DeserializeAreaResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + AreaUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new AreaUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AreaResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AreaResolution)} does not support writing '{options.Format}' format."); + } + } + + AreaResolution 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 DeserializeAreaResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AreaResolution)} 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 AreaResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAreaResolution(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.Conversations/src/Generated/Models/AreaResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.cs new file mode 100644 index 0000000000000..58de77532dea8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the area entity resolution model. + public partial class AreaResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The area Unit of measurement. + internal AreaResolution(double value, AreaUnit unit) + { + ResolutionKind = ResolutionKind.AreaResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The area Unit of measurement. + internal AreaResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, AreaUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal AreaResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The area Unit of measurement. + public AreaUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaUnit.cs new file mode 100644 index 0000000000000..07653412f596f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AreaUnit.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The area unit of measurement. + public readonly partial struct AreaUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AreaUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string SquareKilometerValue = "SquareKilometer"; + private const string SquareHectometerValue = "SquareHectometer"; + private const string SquareDecameterValue = "SquareDecameter"; + private const string SquareDecimeterValue = "SquareDecimeter"; + private const string SquareMeterValue = "SquareMeter"; + private const string SquareCentimeterValue = "SquareCentimeter"; + private const string SquareMillimeterValue = "SquareMillimeter"; + private const string SquareInchValue = "SquareInch"; + private const string SquareFootValue = "SquareFoot"; + private const string SquareMileValue = "SquareMile"; + private const string SquareYardValue = "SquareYard"; + private const string AcreValue = "Acre"; + + /// Unspecified area unit. + public static AreaUnit Unspecified { get; } = new AreaUnit(UnspecifiedValue); + /// Square kilometer area unit. + public static AreaUnit SquareKilometer { get; } = new AreaUnit(SquareKilometerValue); + /// Square hectometer area unit. + public static AreaUnit SquareHectometer { get; } = new AreaUnit(SquareHectometerValue); + /// Square decameter area unit. + public static AreaUnit SquareDecameter { get; } = new AreaUnit(SquareDecameterValue); + /// Square decimeter area unit. + public static AreaUnit SquareDecimeter { get; } = new AreaUnit(SquareDecimeterValue); + /// Square meter area unit. + public static AreaUnit SquareMeter { get; } = new AreaUnit(SquareMeterValue); + /// Square centimeter area unit. + public static AreaUnit SquareCentimeter { get; } = new AreaUnit(SquareCentimeterValue); + /// Square millimeter area unit. + public static AreaUnit SquareMillimeter { get; } = new AreaUnit(SquareMillimeterValue); + /// Square inch area unit. + public static AreaUnit SquareInch { get; } = new AreaUnit(SquareInchValue); + /// Square foot area unit. + public static AreaUnit SquareFoot { get; } = new AreaUnit(SquareFootValue); + /// Square mile area unit. + public static AreaUnit SquareMile { get; } = new AreaUnit(SquareMileValue); + /// Square yard area unit. + public static AreaUnit SquareYard { get; } = new AreaUnit(SquareYardValue); + /// Acre area unit. + public static AreaUnit Acre { get; } = new AreaUnit(AcreValue); + /// Determines if two values are the same. + public static bool operator ==(AreaUnit left, AreaUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AreaUnit left, AreaUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AreaUnit(string value) => new AreaUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AreaUnit other && Equals(other); + /// + public bool Equals(AreaUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.Serialization.cs new file mode 100644 index 0000000000000..cbcb812ae4978 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class AudioTiming : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AudioTiming)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Offset)) + { + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset.Value); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteNumberValue(Duration.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 + } + } + writer.WriteEndObject(); + } + + AudioTiming 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(AudioTiming)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAudioTiming(document.RootElement, options); + } + + internal static AudioTiming DeserializeAudioTiming(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? offset = default; + long? duration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offset = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AudioTiming(offset, duration, 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(AudioTiming)} does not support writing '{options.Format}' format."); + } + } + + AudioTiming 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 DeserializeAudioTiming(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AudioTiming)} 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 AudioTiming FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAudioTiming(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.Conversations/src/Generated/Models/AudioTiming.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.cs new file mode 100644 index 0000000000000..78e42d5ddde4f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/AudioTiming.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.Conversations.Models +{ + /// Audio timing information. + public partial class AudioTiming + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal AudioTiming() + { + } + + /// Initializes a new instance of . + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + /// Keeps track of any properties unknown to the library. + internal AudioTiming(long? offset, long? duration, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Duration = duration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + public long? Offset { get; } + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + public long? Duration { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.Serialization.cs new file mode 100644 index 0000000000000..b695fa1b940fe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.Serialization.cs @@ -0,0 +1,143 @@ +// 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.Conversations.Models +{ + public partial class BooleanResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BooleanResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteBooleanValue(Value); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + BooleanResolution 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(BooleanResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBooleanResolution(document.RootElement, options); + } + + internal static BooleanResolution DeserializeBooleanResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool value = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BooleanResolution(resolutionKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BooleanResolution)} does not support writing '{options.Format}' format."); + } + } + + BooleanResolution 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 DeserializeBooleanResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BooleanResolution)} 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 BooleanResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBooleanResolution(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.Conversations/src/Generated/Models/BooleanResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.cs new file mode 100644 index 0000000000000..749c6a92d13f4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/BooleanResolution.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A resolution for boolean expressions. + public partial class BooleanResolution : ResolutionBase + { + /// Initializes a new instance of . + /// A resolution for boolean expressions. + internal BooleanResolution(bool value) + { + ResolutionKind = ResolutionKind.BooleanResolution; + Value = value; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// A resolution for boolean expressions. + internal BooleanResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, bool value) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal BooleanResolution() + { + } + + /// A resolution for boolean expressions. + public bool Value { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs new file mode 100644 index 0000000000000..a035fcd226ef3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class ConversationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(Verbose)) + { + writer.WritePropertyName("verbose"u8); + writer.WriteBooleanValue(Verbose.Value); + } + if (Optional.IsDefined(IsLoggingEnabled)) + { + writer.WritePropertyName("isLoggingEnabled"u8); + writer.WriteBooleanValue(IsLoggingEnabled.Value); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(DirectTarget)) + { + writer.WritePropertyName("directTarget"u8); + writer.WriteStringValue(DirectTarget); + } + if (Optional.IsCollectionDefined(TargetProjectParameters)) + { + writer.WritePropertyName("targetProjectParameters"u8); + writer.WriteStartObject(); + foreach (var item in TargetProjectParameters) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + 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 + } + } + writer.WriteEndObject(); + } + + ConversationActionContent 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(ConversationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationActionContent(document.RootElement, options); + } + + internal static ConversationActionContent DeserializeConversationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string projectName = default; + string deploymentName = default; + bool? verbose = default; + bool? isLoggingEnabled = default; + StringIndexType? stringIndexType = default; + string directTarget = default; + IDictionary targetProjectParameters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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("verbose"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + verbose = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("isLoggingEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLoggingEnabled = 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("directTarget"u8)) + { + directTarget = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetProjectParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, AnalysisConfig.DeserializeAnalysisConfig(property0.Value, options)); + } + targetProjectParameters = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationActionContent( + projectName, + deploymentName, + verbose, + isLoggingEnabled, + stringIndexType, + directTarget, + targetProjectParameters ?? new ChangeTrackingDictionary(), + 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(ConversationActionContent)} does not support writing '{options.Format}' format."); + } + } + + ConversationActionContent 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 DeserializeConversationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationActionContent)} 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 ConversationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationActionContent(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.Conversations/src/Generated/Models/ConversationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs new file mode 100644 index 0000000000000..4a94dc88ad664 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionContent.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Input parameters necessary for a Conversation task. + internal partial class ConversationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the project to use. + /// The name of the deployment to use. + /// or is null. + public ConversationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + TargetProjectParameters = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The name of the project to use. + /// The name of the deployment to use. + /// If true, the service will return more detailed information in the response. + /// If true, the service will keep the query for further review. + /// 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. + /// The name of a target project to forward the request to. + /// + /// A dictionary representing the parameters for each target project. + /// 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 ConversationActionContent(string projectName, string deploymentName, bool? verbose, bool? isLoggingEnabled, StringIndexType? stringIndexType, string directTarget, IDictionary targetProjectParameters, IDictionary serializedAdditionalRawData) + { + ProjectName = projectName; + DeploymentName = deploymentName; + Verbose = verbose; + IsLoggingEnabled = isLoggingEnabled; + StringIndexType = stringIndexType; + DirectTarget = directTarget; + TargetProjectParameters = targetProjectParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationActionContent() + { + } + + /// The name of the project to use. + public string ProjectName { get; } + /// The name of the deployment to use. + public string DeploymentName { get; } + /// If true, the service will return more detailed information in the response. + public bool? Verbose { get; set; } + /// If true, the service will keep the query for further review. + public bool? IsLoggingEnabled { 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; } + /// The name of a target project to forward the request to. + public string DirectTarget { get; set; } + /// + /// A dictionary representing the parameters for each target project. + /// 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 IDictionary TargetProjectParameters { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.Serialization.cs new file mode 100644 index 0000000000000..b4aa6ad885c4a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.Serialization.cs @@ -0,0 +1,143 @@ +// 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.Conversations.Models +{ + public partial class ConversationActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationActionResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationActionResult 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(ConversationActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationActionResult(document.RootElement, options); + } + + internal static ConversationActionResult DeserializeConversationActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeConversationResult result = default; + AnalyzeConversationResultKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + result = AnalyzeConversationResult.DeserializeAnalyzeConversationResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationResultKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationActionResult(kind, serializedAdditionalRawData, result); + } + + 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(ConversationActionResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationActionResult 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 DeserializeConversationActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationActionResult)} 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 ConversationActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationActionResult(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.Conversations/src/Generated/Models/ConversationActionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.cs new file mode 100644 index 0000000000000..eb45be866a867 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The results of a Conversation task. + public partial class ConversationActionResult : AnalyzeConversationActionResult + { + /// Initializes a new instance of . + /// Represents a conversation analysis response. + /// is null. + internal ConversationActionResult(AnalyzeConversationResult result) + { + Argument.AssertNotNull(result, nameof(result)); + + Kind = AnalyzeConversationResultKind.ConversationResult; + Result = result; + } + + /// Initializes a new instance of . + /// The base class of a conversation input task result. + /// Keeps track of any properties unknown to the library. + /// Represents a conversation analysis response. + internal ConversationActionResult(AnalyzeConversationResultKind kind, IDictionary serializedAdditionalRawData, AnalyzeConversationResult result) : base(kind, serializedAdditionalRawData) + { + Result = result; + } + + /// Initializes a new instance of for deserialization. + internal ConversationActionResult() + { + } + + /// Represents a conversation analysis response. + public AnalyzeConversationResult Result { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionState.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionState.cs new file mode 100644 index 0000000000000..73e624bd913a2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActionState.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.Conversations.Models +{ + /// The status of the task at the mentioned last update time. + public readonly partial struct ConversationActionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConversationActionState(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 state. + public static ConversationActionState NotStarted { get; } = new ConversationActionState(NotStartedValue); + /// Running state. + public static ConversationActionState Running { get; } = new ConversationActionState(RunningValue); + /// Succeeded state. + public static ConversationActionState Succeeded { get; } = new ConversationActionState(SucceededValue); + /// Partially completed state. + public static ConversationActionState PartiallyCompleted { get; } = new ConversationActionState(PartiallyCompletedValue); + /// Failed state. + public static ConversationActionState Failed { get; } = new ConversationActionState(FailedValue); + /// Cancelled state. + public static ConversationActionState Cancelled { get; } = new ConversationActionState(CancelledValue); + /// Cancelling state. + public static ConversationActionState Cancelling { get; } = new ConversationActionState(CancellingValue); + /// Determines if two values are the same. + public static bool operator ==(ConversationActionState left, ConversationActionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConversationActionState left, ConversationActionState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConversationActionState(string value) => new ConversationActionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConversationActionState other && Equals(other); + /// + public bool Equals(ConversationActionState 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.Conversations/src/Generated/Models/ConversationActions.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActions.Serialization.cs new file mode 100644 index 0000000000000..11307ae89a1ee --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActions.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class ConversationActions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationActions)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationActions 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(ConversationActions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationActions(document.RootElement, options); + } + + internal static ConversationActions DeserializeConversationActions(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(AnalyzeConversationOperationResult.DeserializeAnalyzeConversationOperationResult(item, options)); + } + items = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationActions( + 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(ConversationActions)} does not support writing '{options.Format}' format."); + } + } + + ConversationActions 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 DeserializeConversationActions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationActions)} 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 ConversationActions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationActions(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.Conversations/src/Generated/Models/ConversationActions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActions.cs new file mode 100644 index 0000000000000..7c93d0ac270c0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationActions.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.Conversations.Models +{ + /// Contains the state for the tasks that are being executed as part of the submitted job for analyzing a conversation. + public partial class ConversationActions + { + /// + /// 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 tasks that finished successfully. + /// Count of tasks that failed. + /// Count of tasks that are currently in progress. + /// Total count of tasks submitted as part of the job. + internal ConversationActions(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 tasks that finished successfully. + /// Count of tasks that failed. + /// Count of tasks that are currently in progress. + /// Total count of tasks submitted as part of the job. + /// + /// List of results from tasks (if available). + /// 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 ConversationActions(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 ConversationActions() + { + } + + /// Count of tasks that finished successfully. + public int Completed { get; } + /// Count of tasks that failed. + public int Failed { get; } + /// Count of tasks that are currently in progress. + public int InProgress { get; } + /// Total count of tasks submitted as part of the job. + public int Total { get; } + /// + /// List of results from tasks (if available). + /// 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.Conversations/src/Generated/Models/ConversationAnalysisInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationAnalysisInput.Serialization.cs new file mode 100644 index 0000000000000..e93e0dad07e09 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationAnalysisInput.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class ConversationAnalysisInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationAnalysisInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("conversationItem"u8); + writer.WriteObjectValue(ConversationItem, 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 + } + } + writer.WriteEndObject(); + } + + ConversationAnalysisInput 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(ConversationAnalysisInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationAnalysisInput(document.RootElement, options); + } + + internal static ConversationAnalysisInput DeserializeConversationAnalysisInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TextConversationItem conversationItem = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversationItem"u8)) + { + conversationItem = TextConversationItem.DeserializeTextConversationItem(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationAnalysisInput(conversationItem, 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(ConversationAnalysisInput)} does not support writing '{options.Format}' format."); + } + } + + ConversationAnalysisInput 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 DeserializeConversationAnalysisInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationAnalysisInput)} 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 ConversationAnalysisInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationAnalysisInput(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.Conversations/src/Generated/Models/ConversationAnalysisInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationAnalysisInput.cs new file mode 100644 index 0000000000000..a712ceb9f8cda --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationAnalysisInput.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The input ConversationItem and its optional parameters. + internal partial class ConversationAnalysisInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The abstract base for a user input formatted conversation (e.g., Text, Transcript). + /// is null. + public ConversationAnalysisInput(TextConversationItem conversationItem) + { + Argument.AssertNotNull(conversationItem, nameof(conversationItem)); + + ConversationItem = conversationItem; + } + + /// Initializes a new instance of . + /// The abstract base for a user input formatted conversation (e.g., Text, Transcript). + /// Keeps track of any properties unknown to the library. + internal ConversationAnalysisInput(TextConversationItem conversationItem, IDictionary serializedAdditionalRawData) + { + ConversationItem = conversationItem; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationAnalysisInput() + { + } + + /// The abstract base for a user input formatted conversation (e.g., Text, Transcript). + public TextConversationItem ConversationItem { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.Serialization.cs new file mode 100644 index 0000000000000..bc67b5a3f0ed0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.Serialization.cs @@ -0,0 +1,168 @@ +// 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.Conversations.Models +{ + internal partial class ConversationCallingConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationCallingConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + } + if (Optional.IsDefined(Verbose)) + { + writer.WritePropertyName("verbose"u8); + writer.WriteBooleanValue(Verbose.Value); + } + if (Optional.IsDefined(IsLoggingEnabled)) + { + writer.WritePropertyName("isLoggingEnabled"u8); + writer.WriteBooleanValue(IsLoggingEnabled.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 + } + } + writer.WriteEndObject(); + } + + ConversationCallingConfig 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(ConversationCallingConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationCallingConfig(document.RootElement, options); + } + + internal static ConversationCallingConfig DeserializeConversationCallingConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string language = default; + bool? verbose = default; + bool? isLoggingEnabled = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("verbose"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + verbose = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("isLoggingEnabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isLoggingEnabled = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationCallingConfig(language, verbose, isLoggingEnabled, 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(ConversationCallingConfig)} does not support writing '{options.Format}' format."); + } + } + + ConversationCallingConfig 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 DeserializeConversationCallingConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationCallingConfig)} 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 ConversationCallingConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationCallingConfig(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.Conversations/src/Generated/Models/ConversationCallingConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.cs new file mode 100644 index 0000000000000..f89b399912807 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationCallingConfig.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.Conversations.Models +{ + /// The option to set to call a Conversation project. + internal partial class ConversationCallingConfig + { + /// + /// 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 ConversationCallingConfig() + { + } + + /// Initializes a new instance of . + /// The language of the query in BCP 47 language representation. + /// If true, the service will return more detailed information. + /// If true, the query will be saved for customers to further review in authoring, to improve the model quality. + /// Keeps track of any properties unknown to the library. + internal ConversationCallingConfig(string language, bool? verbose, bool? isLoggingEnabled, IDictionary serializedAdditionalRawData) + { + Language = language; + Verbose = verbose; + IsLoggingEnabled = isLoggingEnabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The language of the query in BCP 47 language representation. + public string Language { get; set; } + /// If true, the service will return more detailed information. + public bool? Verbose { get; set; } + /// If true, the query will be saved for customers to further review in authoring, to improve the model quality. + public bool? IsLoggingEnabled { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.Serialization.cs new file mode 100644 index 0000000000000..d3e8919f527ba --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.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.Conversations.Models +{ + internal partial class ConversationConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(CallingOptions)) + { + writer.WritePropertyName("callingOptions"u8); + writer.WriteObjectValue(CallingOptions, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + 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 + } + } + writer.WriteEndObject(); + } + + ConversationConfig 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(ConversationConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationConfig(document.RootElement, options); + } + + internal static ConversationConfig DeserializeConversationConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationCallingConfig callingOptions = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("callingOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callingOptions = ConversationCallingConfig.DeserializeConversationCallingConfig(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationConfig(targetProjectKind, apiVersion, serializedAdditionalRawData, callingOptions); + } + + 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(ConversationConfig)} does not support writing '{options.Format}' format."); + } + } + + ConversationConfig 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 DeserializeConversationConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationConfig)} 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 ConversationConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationConfig(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.Conversations/src/Generated/Models/ConversationConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.cs new file mode 100644 index 0000000000000..113052416288f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationConfig.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.Conversations.Models +{ + /// This is a set of request parameters for Customized Conversation projects. + internal partial class ConversationConfig : AnalysisConfig + { + /// Initializes a new instance of . + public ConversationConfig() + { + TargetProjectKind = TargetProjectKind.Conversation; + } + + /// Initializes a new instance of . + /// The type of a target service. + /// The API version to use when call a specific target service. + /// Keeps track of any properties unknown to the library. + /// The option to set to call a Conversation project. + internal ConversationConfig(TargetProjectKind targetProjectKind, string apiVersion, IDictionary serializedAdditionalRawData, ConversationCallingConfig callingOptions) : base(targetProjectKind, apiVersion, serializedAdditionalRawData) + { + CallingOptions = callingOptions; + } + + /// The option to set to call a Conversation project. + public ConversationCallingConfig CallingOptions { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationDomain.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationDomain.cs new file mode 100644 index 0000000000000..8834c4efcf68f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationDomain.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.Conversations.Models +{ + /// Enumeration of supported conversational domains. + public readonly partial struct ConversationDomain : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConversationDomain(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FinanceValue = "finance"; + private const string HealthcareValue = "healthcare"; + private const string GenericValue = "generic"; + + /// Enumeration of supported conversational domains. + public static ConversationDomain Finance { get; } = new ConversationDomain(FinanceValue); + /// Enumeration of supported conversational domains. + public static ConversationDomain Healthcare { get; } = new ConversationDomain(HealthcareValue); + /// Enumeration of supported conversational domains. + public static ConversationDomain Generic { get; } = new ConversationDomain(GenericValue); + /// Determines if two values are the same. + public static bool operator ==(ConversationDomain left, ConversationDomain right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConversationDomain left, ConversationDomain right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConversationDomain(string value) => new ConversationDomain(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConversationDomain other && Equals(other); + /// + public bool Equals(ConversationDomain 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.Conversations/src/Generated/Models/ConversationEntity.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntity.Serialization.cs new file mode 100644 index 0000000000000..b22bf2e9781c5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntity.Serialization.cs @@ -0,0 +1,225 @@ +// 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.Conversations.Models +{ + public partial class ConversationEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationEntity)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + if (Optional.IsCollectionDefined(Resolutions)) + { + writer.WritePropertyName("resolutions"u8); + writer.WriteStartArray(); + foreach (var item in Resolutions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ExtraInformation)) + { + writer.WritePropertyName("extraInformation"u8); + writer.WriteStartArray(); + foreach (var item in ExtraInformation) + { + 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 + } + } + writer.WriteEndObject(); + } + + ConversationEntity 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(ConversationEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationEntity(document.RootElement, options); + } + + internal static ConversationEntity DeserializeConversationEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string category = default; + string text = default; + int offset = default; + int length = default; + float confidenceScore = default; + IReadOnlyList resolutions = default; + IReadOnlyList extraInformation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("resolutions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResolutionBase.DeserializeResolutionBase(item, options)); + } + resolutions = array; + continue; + } + if (property.NameEquals("extraInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationEntityExtraInformation.DeserializeConversationEntityExtraInformation(item, options)); + } + extraInformation = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationEntity( + category, + text, + offset, + length, + confidenceScore, + resolutions ?? new ChangeTrackingList(), + extraInformation ?? 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(ConversationEntity)} does not support writing '{options.Format}' format."); + } + } + + ConversationEntity 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 DeserializeConversationEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationEntity)} 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 ConversationEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationEntity(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.Conversations/src/Generated/Models/ConversationEntity.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntity.cs new file mode 100644 index 0000000000000..2d96b7ac133f4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntity.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The entity extraction result of a Conversation project. + public partial class ConversationEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The entity category. + /// The predicted entity text. + /// The starting index of this entity in the query. + /// The length of the text. + /// The entity confidence score. + /// or is null. + internal ConversationEntity(string category, string text, int offset, int length, float confidence) + { + Argument.AssertNotNull(category, nameof(category)); + Argument.AssertNotNull(text, nameof(text)); + + Category = category; + Text = text; + Offset = offset; + Length = length; + Confidence = confidence; + Resolutions = new ChangeTrackingList(); + ExtraInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity category. + /// The predicted entity text. + /// The starting index of this entity in the query. + /// The length of the text. + /// The entity confidence score. + /// + /// The collection of entity resolution objects. + /// 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 . + /// + /// + /// The collection of entity extra information objects. + /// 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 ConversationEntity(string category, string text, int offset, int length, float confidence, IReadOnlyList resolutions, IReadOnlyList extraInformation, IDictionary serializedAdditionalRawData) + { + Category = category; + Text = text; + Offset = offset; + Length = length; + Confidence = confidence; + Resolutions = resolutions; + ExtraInformation = extraInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationEntity() + { + } + + /// The entity category. + public string Category { get; } + /// The predicted entity text. + public string Text { get; } + /// The starting index of this entity in the query. + public int Offset { get; } + /// The length of the text. + public int Length { get; } + /// The entity confidence score. + public float Confidence { get; } + /// + /// The collection of entity resolution objects. + /// 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 Resolutions { get; } + /// + /// The collection of entity extra information objects. + /// 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 ExtraInformation { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.Serialization.cs new file mode 100644 index 0000000000000..1a89de75a6b84 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.Serialization.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownConversationEntityExtraInformation))] + public partial class ConversationEntityExtraInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationEntityExtraInformation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("extraInformationKind"u8); + writer.WriteStringValue(ExtraInformationKind.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 + } + } + writer.WriteEndObject(); + } + + ConversationEntityExtraInformation 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(ConversationEntityExtraInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationEntityExtraInformation(document.RootElement, options); + } + + internal static ConversationEntityExtraInformation DeserializeConversationEntityExtraInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("extraInformationKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "EntitySubtype": return EntitySubtype.DeserializeEntitySubtype(element, options); + case "ListKey": return ListKey.DeserializeListKey(element, options); + case "RegexKey": return RegexKey.DeserializeRegexKey(element, options); + } + } + return UnknownConversationEntityExtraInformation.DeserializeUnknownConversationEntityExtraInformation(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(ConversationEntityExtraInformation)} does not support writing '{options.Format}' format."); + } + } + + ConversationEntityExtraInformation 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 DeserializeConversationEntityExtraInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationEntityExtraInformation)} 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 ConversationEntityExtraInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationEntityExtraInformation(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.Conversations/src/Generated/Models/ConversationEntityExtraInformation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.cs new file mode 100644 index 0000000000000..65afcdf54dc6c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationEntityExtraInformation.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.Conversations.Models +{ + /// + /// The abstract base object for entity extra information. + /// 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 ConversationEntityExtraInformation + { + /// + /// 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 ConversationEntityExtraInformation() + { + } + + /// Initializes a new instance of . + /// The extra information object kind. + /// Keeps track of any properties unknown to the library. + internal ConversationEntityExtraInformation(ExtraInformationKind extraInformationKind, IDictionary serializedAdditionalRawData) + { + ExtraInformationKind = extraInformationKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The extra information object kind. + internal ExtraInformationKind ExtraInformationKind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.Serialization.cs new file mode 100644 index 0000000000000..d5d0e5c4caccb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.Serialization.cs @@ -0,0 +1,200 @@ +// 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.Conversations.Models +{ + public partial class ConversationError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationError)} does not support writing '{format}' format."); + } + + 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, 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 + } + } + writer.WriteEndObject(); + } + + ConversationError 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(ConversationError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationError(document.RootElement, options); + } + + internal static ConversationError DeserializeConversationError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationErrorCode 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 ConversationErrorCode(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(DeserializeConversationError(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 ConversationError( + 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(ConversationError)} does not support writing '{options.Format}' format."); + } + } + + ConversationError 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 DeserializeConversationError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationError)} 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 ConversationError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationError(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.Conversations/src/Generated/Models/ConversationError.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.cs new file mode 100644 index 0000000000000..d4d59d2175d07 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationError.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.Conversations.Models +{ + /// The error object. + public partial class ConversationError + { + /// + /// 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 ConversationError(ConversationErrorCode 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 ConversationError(ConversationErrorCode 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 ConversationError() + { + } + + /// One of a server-defined set of error codes. + public ConversationErrorCode 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.Conversations/src/Generated/Models/ConversationErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationErrorCode.cs new file mode 100644 index 0000000000000..ba5e98cfe3203 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationErrorCode.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.Conversations.Models +{ + /// Human-readable error code. + public readonly partial struct ConversationErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConversationErrorCode(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 ConversationErrorCode InvalidRequest { get; } = new ConversationErrorCode(InvalidRequestValue); + /// Invalid argument error. + public static ConversationErrorCode InvalidArgument { get; } = new ConversationErrorCode(InvalidArgumentValue); + /// Unauthorized access error. + public static ConversationErrorCode Unauthorized { get; } = new ConversationErrorCode(UnauthorizedValue); + /// Forbidden access error. + public static ConversationErrorCode Forbidden { get; } = new ConversationErrorCode(ForbiddenValue); + /// Not found error. + public static ConversationErrorCode NotFound { get; } = new ConversationErrorCode(NotFoundValue); + /// Project not found error. + public static ConversationErrorCode ProjectNotFound { get; } = new ConversationErrorCode(ProjectNotFoundValue); + /// Operation not found error. + public static ConversationErrorCode OperationNotFound { get; } = new ConversationErrorCode(OperationNotFoundValue); + /// Azure Cognitive Search not found error. + public static ConversationErrorCode AzureCognitiveSearchNotFound { get; } = new ConversationErrorCode(AzureCognitiveSearchNotFoundValue); + /// Azure Cognitive Search index not found error. + public static ConversationErrorCode AzureCognitiveSearchIndexNotFound { get; } = new ConversationErrorCode(AzureCognitiveSearchIndexNotFoundValue); + /// Too many requests error. + public static ConversationErrorCode TooManyRequests { get; } = new ConversationErrorCode(TooManyRequestsValue); + /// Azure Cognitive Search throttling error. + public static ConversationErrorCode AzureCognitiveSearchThrottling { get; } = new ConversationErrorCode(AzureCognitiveSearchThrottlingValue); + /// Azure Cognitive Search index limit reached error. + public static ConversationErrorCode AzureCognitiveSearchIndexLimitReached { get; } = new ConversationErrorCode(AzureCognitiveSearchIndexLimitReachedValue); + /// Internal server error. + public static ConversationErrorCode InternalServerError { get; } = new ConversationErrorCode(InternalServerErrorValue); + /// Service unavailable error. + public static ConversationErrorCode ServiceUnavailable { get; } = new ConversationErrorCode(ServiceUnavailableValue); + /// Timeout error. + public static ConversationErrorCode Timeout { get; } = new ConversationErrorCode(TimeoutValue); + /// Quota exceeded error. + public static ConversationErrorCode QuotaExceeded { get; } = new ConversationErrorCode(QuotaExceededValue); + /// Conflict error. + public static ConversationErrorCode Conflict { get; } = new ConversationErrorCode(ConflictValue); + /// Warning error. + public static ConversationErrorCode Warning { get; } = new ConversationErrorCode(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(ConversationErrorCode left, ConversationErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConversationErrorCode left, ConversationErrorCode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConversationErrorCode(string value) => new ConversationErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConversationErrorCode other && Equals(other); + /// + public bool Equals(ConversationErrorCode 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.Conversations/src/Generated/Models/ConversationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationInput.Serialization.cs new file mode 100644 index 0000000000000..2b1495aa9bc30 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationInput.Serialization.cs @@ -0,0 +1,136 @@ +// 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.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownConversationInput))] + public partial class ConversationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.ToString()); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConversationInput 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(ConversationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationInput(document.RootElement, options); + } + + internal static ConversationInput DeserializeConversationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("modality", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "text": return TextConversation.DeserializeTextConversation(element, options); + case "transcript": return TranscriptConversation.DeserializeTranscriptConversation(element, options); + } + } + return UnknownConversationInput.DeserializeUnknownConversationInput(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(ConversationInput)} does not support writing '{options.Format}' format."); + } + } + + ConversationInput 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 DeserializeConversationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationInput)} 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 ConversationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationInput(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.Conversations/src/Generated/Models/ConversationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationInput.cs new file mode 100644 index 0000000000000..c60dd4b49efa1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationInput.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.Conversations.Models +{ + /// + /// Complete ordered set of utterances (spoken or written) by one or more speakers to be used for 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 and . + /// + public abstract partial class ConversationInput + { + /// + /// 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 . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// or is null. + protected ConversationInput(string id, string language) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(language, nameof(language)); + + Id = id; + Language = language; + } + + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// modality. + /// domain. + /// Keeps track of any properties unknown to the library. + internal ConversationInput(string id, string language, InputModality modality, ConversationDomain? domain, IDictionary serializedAdditionalRawData) + { + Id = id; + Language = language; + Modality = modality; + Domain = domain; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationInput() + { + } + + /// Unique identifier for the conversation. + public string Id { get; } + /// Language of the conversation item in BCP-47 format. + public string Language { get; } + /// modality. + internal InputModality Modality { get; set; } + /// domain. + public ConversationDomain? Domain { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.Serialization.cs new file mode 100644 index 0000000000000..63996e7e8538f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.Serialization.cs @@ -0,0 +1,143 @@ +// 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.Conversations.Models +{ + public partial class ConversationIntent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationIntent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationIntent 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(ConversationIntent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationIntent(document.RootElement, options); + } + + internal static ConversationIntent DeserializeConversationIntent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string category = default; + float confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationIntent(category, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationIntent)} does not support writing '{options.Format}' format."); + } + } + + ConversationIntent 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 DeserializeConversationIntent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationIntent)} 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 ConversationIntent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationIntent(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.Conversations/src/Generated/Models/ConversationIntent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.cs new file mode 100644 index 0000000000000..fcf368a628d77 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationIntent.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The intent classification result of a Conversation project. + public partial class ConversationIntent + { + /// + /// 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 predicted class. + /// The confidence score of the class from 0.0 to 1.0. + /// is null. + internal ConversationIntent(string category, float confidence) + { + Argument.AssertNotNull(category, nameof(category)); + + Category = category; + Confidence = confidence; + } + + /// Initializes a new instance of . + /// A predicted class. + /// The confidence score of the class from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + internal ConversationIntent(string category, float confidence, IDictionary serializedAdditionalRawData) + { + Category = category; + Confidence = confidence; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationIntent() + { + } + + /// A predicted class. + public string Category { get; } + /// The confidence score of the class from 0.0 to 1.0. + public float Confidence { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.Serialization.cs new file mode 100644 index 0000000000000..83b523a977997 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class ConversationItemLevelTiming : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationItemLevelTiming)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Offset)) + { + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset.Value); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteNumberValue(Duration.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 + } + } + writer.WriteEndObject(); + } + + ConversationItemLevelTiming 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(ConversationItemLevelTiming)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationItemLevelTiming(document.RootElement, options); + } + + internal static ConversationItemLevelTiming DeserializeConversationItemLevelTiming(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? offset = default; + long? duration = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offset = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationItemLevelTiming(offset, duration, 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(ConversationItemLevelTiming)} does not support writing '{options.Format}' format."); + } + } + + ConversationItemLevelTiming 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 DeserializeConversationItemLevelTiming(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationItemLevelTiming)} 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 ConversationItemLevelTiming FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationItemLevelTiming(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.Conversations/src/Generated/Models/ConversationItemLevelTiming.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.cs new file mode 100644 index 0000000000000..bd6a3b50fe25c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationItemLevelTiming.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.Conversations.Models +{ + /// Audio timing at the conversation item level. + public partial class ConversationItemLevelTiming + { + /// + /// 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 ConversationItemLevelTiming() + { + } + + /// Initializes a new instance of . + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + /// Keeps track of any properties unknown to the library. + internal ConversationItemLevelTiming(long? offset, long? duration, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Duration = duration; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + public long? Offset { get; set; } + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + public long? Duration { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs new file mode 100644 index 0000000000000..1d68ee7e78f6a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.Serialization.cs @@ -0,0 +1,256 @@ +// 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.Conversations.Models +{ + public partial class ConversationPiiActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationPiiActionContent)} does not support writing '{format}' format."); + } + + 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.IsCollectionDefined(PiiCategories)) + { + writer.WritePropertyName("piiCategories"u8); + writer.WriteStartArray(); + foreach (var item in PiiCategories) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RedactAudioTiming)) + { + writer.WritePropertyName("redactAudioTiming"u8); + writer.WriteBooleanValue(RedactAudioTiming.Value); + } + if (Optional.IsDefined(RedactionSource)) + { + writer.WritePropertyName("redactionSource"u8); + writer.WriteStringValue(RedactionSource.Value.ToString()); + } + if (Optional.IsDefined(RedactionCharacter)) + { + writer.WritePropertyName("redactionCharacter"u8); + writer.WriteStringValue(RedactionCharacter.Value.ToString()); + } + if (Optional.IsCollectionDefined(ExcludePiiCategories)) + { + writer.WritePropertyName("excludePiiCategories"u8); + writer.WriteStartArray(); + foreach (var item in ExcludePiiCategories) + { + writer.WriteStringValue(item.ToString()); + } + 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 + } + } + writer.WriteEndObject(); + } + + ConversationPiiActionContent 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(ConversationPiiActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationPiiActionContent(document.RootElement, options); + } + + internal static ConversationPiiActionContent DeserializeConversationPiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + IList piiCategories = default; + bool? redactAudioTiming = default; + TranscriptContentType? redactionSource = default; + RedactionCharacter? redactionCharacter = default; + IList excludePiiCategories = 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("piiCategories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ConversationPiiCategories(item.GetString())); + } + piiCategories = array; + continue; + } + if (property.NameEquals("redactAudioTiming"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactAudioTiming = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("redactionSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionSource = new TranscriptContentType(property.Value.GetString()); + continue; + } + if (property.NameEquals("redactionCharacter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionCharacter = new RedactionCharacter(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 ConversationPiiCategoryExclusions(item.GetString())); + } + excludePiiCategories = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationPiiActionContent( + loggingOptOut, + modelVersion, + piiCategories ?? new ChangeTrackingList(), + redactAudioTiming, + redactionSource, + redactionCharacter, + excludePiiCategories ?? 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(ConversationPiiActionContent)} does not support writing '{options.Format}' format."); + } + } + + ConversationPiiActionContent 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 DeserializeConversationPiiActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationPiiActionContent)} 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 ConversationPiiActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationPiiActionContent(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.Conversations/src/Generated/Models/ConversationPiiActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs new file mode 100644 index 0000000000000..fc962a1384483 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiActionContent.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Supported parameters for a conversational pii task. + public partial class ConversationPiiActionContent + { + /// + /// 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 ConversationPiiActionContent() + { + PiiCategories = new ChangeTrackingList(); + ExcludePiiCategories = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Array of ConversationPIICategories. + /// Flag to indicate if response should include audio stream offset and duration for any detected entities to be redacted. By default, audio timing of redacted entities are not included. + /// For transcript conversations, this parameter provides information regarding which content type (ITN, Text, Lexical, Masked ITN) should be used for entity detection. The details of the entities detected - like the offset, length and the text itself - will correspond to the text type selected here. + /// 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. + /// List of categories that need to be excluded instead of included. + /// Keeps track of any properties unknown to the library. + internal ConversationPiiActionContent(bool? loggingOptOut, string modelVersion, IList piiCategories, bool? redactAudioTiming, TranscriptContentType? redactionSource, RedactionCharacter? redactionCharacter, IList excludePiiCategories, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + PiiCategories = piiCategories; + RedactAudioTiming = redactAudioTiming; + RedactionSource = redactionSource; + RedactionCharacter = redactionCharacter; + ExcludePiiCategories = excludePiiCategories; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Array of ConversationPIICategories. + public IList PiiCategories { get; } + /// Flag to indicate if response should include audio stream offset and duration for any detected entities to be redacted. By default, audio timing of redacted entities are not included. + public bool? RedactAudioTiming { get; set; } + /// For transcript conversations, this parameter provides information regarding which content type (ITN, Text, Lexical, Masked ITN) should be used for entity detection. The details of the entities detected - like the offset, length and the text itself - will correspond to the text type selected here. + public TranscriptContentType? RedactionSource { get; set; } + /// 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; } + /// List of categories that need to be excluded instead of included. + public IList ExcludePiiCategories { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs new file mode 100644 index 0000000000000..0e06f5b396d6b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategories.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Describes the PII categories to return for detection. If not provided, 'default' categories will be returned which will vary with the language. + public readonly partial struct ConversationPiiCategories : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConversationPiiCategories(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddressValue = "Address"; + private const string CreditCardNumberValue = "CreditCardNumber"; + private const string EmailValue = "Email"; + private const string PersonValue = "Person"; + private const string NumericIdentifierValue = "NumericIdentifier"; + private const string PhoneNumberValue = "PhoneNumber"; + private const string UsSocialSecurityNumberValue = "USSocialSecurityNumber"; + private const string MiscellaneousValue = "Miscellaneous"; + private const string AllValue = "All"; + private const string DefaultValue = "Default"; + + /// Address category. + public static ConversationPiiCategories Address { get; } = new ConversationPiiCategories(AddressValue); + /// Credit card number category. + public static ConversationPiiCategories CreditCardNumber { get; } = new ConversationPiiCategories(CreditCardNumberValue); + /// Email category. + public static ConversationPiiCategories Email { get; } = new ConversationPiiCategories(EmailValue); + /// Person category. + public static ConversationPiiCategories Person { get; } = new ConversationPiiCategories(PersonValue); + /// Numeric identifier category. + public static ConversationPiiCategories NumericIdentifier { get; } = new ConversationPiiCategories(NumericIdentifierValue); + /// Phone number category. + public static ConversationPiiCategories PhoneNumber { get; } = new ConversationPiiCategories(PhoneNumberValue); + /// US social security number category. + public static ConversationPiiCategories UsSocialSecurityNumber { get; } = new ConversationPiiCategories(UsSocialSecurityNumberValue); + /// Miscellaneous category. + public static ConversationPiiCategories Miscellaneous { get; } = new ConversationPiiCategories(MiscellaneousValue); + /// All categories. + public static ConversationPiiCategories All { get; } = new ConversationPiiCategories(AllValue); + /// Default categories. + public static ConversationPiiCategories Default { get; } = new ConversationPiiCategories(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(ConversationPiiCategories left, ConversationPiiCategories right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConversationPiiCategories left, ConversationPiiCategories right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConversationPiiCategories(string value) => new ConversationPiiCategories(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConversationPiiCategories other && Equals(other); + /// + public bool Equals(ConversationPiiCategories 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.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.cs new file mode 100644 index 0000000000000..9b28533b7abb0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiCategoryExclusions.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.Conversations.Models +{ + /// Describes the PII categories to exclude for detection. If not provided, 'default' categories will be returned which will vary with the language. + public readonly partial struct ConversationPiiCategoryExclusions : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConversationPiiCategoryExclusions(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddressValue = "Address"; + private const string CreditCardNumberValue = "CreditCardNumber"; + private const string EmailValue = "Email"; + private const string PersonValue = "Person"; + private const string NumericIdentifierValue = "NumericIdentifier"; + private const string PhoneNumberValue = "PhoneNumber"; + private const string UsSocialSecurityNumberValue = "USSocialSecurityNumber"; + + /// Address category. + public static ConversationPiiCategoryExclusions Address { get; } = new ConversationPiiCategoryExclusions(AddressValue); + /// Credit card number category. + public static ConversationPiiCategoryExclusions CreditCardNumber { get; } = new ConversationPiiCategoryExclusions(CreditCardNumberValue); + /// Email category. + public static ConversationPiiCategoryExclusions Email { get; } = new ConversationPiiCategoryExclusions(EmailValue); + /// Person category. + public static ConversationPiiCategoryExclusions Person { get; } = new ConversationPiiCategoryExclusions(PersonValue); + /// Numeric identifier category. + public static ConversationPiiCategoryExclusions NumericIdentifier { get; } = new ConversationPiiCategoryExclusions(NumericIdentifierValue); + /// Phone number category. + public static ConversationPiiCategoryExclusions PhoneNumber { get; } = new ConversationPiiCategoryExclusions(PhoneNumberValue); + /// US social security number category. + public static ConversationPiiCategoryExclusions UsSocialSecurityNumber { get; } = new ConversationPiiCategoryExclusions(UsSocialSecurityNumberValue); + /// Determines if two values are the same. + public static bool operator ==(ConversationPiiCategoryExclusions left, ConversationPiiCategoryExclusions right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConversationPiiCategoryExclusions left, ConversationPiiCategoryExclusions right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ConversationPiiCategoryExclusions(string value) => new ConversationPiiCategoryExclusions(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConversationPiiCategoryExclusions other && Equals(other); + /// + public bool Equals(ConversationPiiCategoryExclusions 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.Conversations/src/Generated/Models/ConversationPiiItemResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiItemResult.Serialization.cs new file mode 100644 index 0000000000000..a055f001ec466 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiItemResult.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.Conversations.Models +{ + public partial class ConversationPiiItemResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationPiiItemResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("redactedContent"u8); + writer.WriteObjectValue(RedactedContent, options); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + 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 + } + } + writer.WriteEndObject(); + } + + ConversationPiiItemResult 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(ConversationPiiItemResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationPiiItemResult(document.RootElement, options); + } + + internal static ConversationPiiItemResult DeserializeConversationPiiItemResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + RedactedTranscriptContent redactedContent = default; + IReadOnlyList entities = 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("redactedContent"u8)) + { + redactedContent = RedactedTranscriptContent.DeserializeRedactedTranscriptContent(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntity.DeserializeNamedEntity(item, options)); + } + entities = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationPiiItemResult(id, redactedContent, entities, 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(ConversationPiiItemResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationPiiItemResult 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 DeserializeConversationPiiItemResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationPiiItemResult)} 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 ConversationPiiItemResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationPiiItemResult(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.Conversations/src/Generated/Models/ConversationPiiItemResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiItemResult.cs new file mode 100644 index 0000000000000..e9c08d14eccf0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiItemResult.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; +using System.Linq; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The result from PII detection and redaction operation for each conversation. + public partial class ConversationPiiItemResult + { + /// + /// 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 . + /// Id of the result. + /// Transcript content response that the service generates, with all necessary personally identifiable information redacted. + /// Array of Entities. + /// , or is null. + internal ConversationPiiItemResult(string id, RedactedTranscriptContent redactedContent, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(redactedContent, nameof(redactedContent)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + RedactedContent = redactedContent; + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Id of the result. + /// Transcript content response that the service generates, with all necessary personally identifiable information redacted. + /// Array of Entities. + /// Keeps track of any properties unknown to the library. + internal ConversationPiiItemResult(string id, RedactedTranscriptContent redactedContent, IReadOnlyList entities, IDictionary serializedAdditionalRawData) + { + Id = id; + RedactedContent = redactedContent; + Entities = entities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationPiiItemResult() + { + } + + /// Id of the result. + public string Id { get; } + /// Transcript content response that the service generates, with all necessary personally identifiable information redacted. + public RedactedTranscriptContent RedactedContent { get; } + /// Array of Entities. + public IReadOnlyList Entities { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.Serialization.cs new file mode 100644 index 0000000000000..82f202745fab9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// 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.Conversations.Models +{ + public partial class ConversationPiiOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationPiiOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConversationPiiOperationResult 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(ConversationPiiOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationPiiOperationResult(document.RootElement, options); + } + + internal static ConversationPiiOperationResult DeserializeConversationPiiOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationPiiResults results = default; + DateTimeOffset lastUpdateDateTime = default; + ConversationActionState status = default; + string taskName = default; + AnalyzeConversationOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = ConversationPiiResults.DeserializeConversationPiiResults(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new ConversationActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationPiiOperationResult( + 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(ConversationPiiOperationResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationPiiOperationResult 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 DeserializeConversationPiiOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationPiiOperationResult)} 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 ConversationPiiOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationPiiOperationResult(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.Conversations/src/Generated/Models/ConversationPiiOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.cs new file mode 100644 index 0000000000000..f215082d5f342 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiOperationResult.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.Conversations.Models +{ + /// Result from the personally identifiable information detection and redaction operation performed on a list of conversations. + public partial class ConversationPiiOperationResult : AnalyzeConversationOperationResult + { + /// 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. + /// is null. + internal ConversationPiiOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, ConversationPiiResults results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeConversationOperationResultsKind.PiiOperationResults; + 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. + /// discriminator kind. + /// Keeps track of any properties unknown to the library. + /// results. + internal ConversationPiiOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, string name, AnalyzeConversationOperationResultsKind kind, IDictionary serializedAdditionalRawData, ConversationPiiResults results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal ConversationPiiOperationResult() + { + } + + /// results. + public ConversationPiiResults Results { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.Serialization.cs new file mode 100644 index 0000000000000..d1392d473e1fe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.Serialization.cs @@ -0,0 +1,186 @@ +// 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.Conversations.Models +{ + public partial class ConversationPiiResults : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationPiiResults)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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("conversations"u8); + writer.WriteStartArray(); + foreach (var item in Conversations) + { + 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 + } + } + writer.WriteEndObject(); + } + + ConversationPiiResults 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(ConversationPiiResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationPiiResults(document.RootElement, options); + } + + internal static ConversationPiiResults DeserializeConversationPiiResults(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 conversations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("conversations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationalPiiResultWithResultBase.DeserializeConversationalPiiResultWithResultBase(item, options)); + } + conversations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationPiiResults(errors, statistics, modelVersion, conversations, 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(ConversationPiiResults)} does not support writing '{options.Format}' format."); + } + } + + ConversationPiiResults 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 DeserializeConversationPiiResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationPiiResults)} 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 ConversationPiiResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationPiiResults(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.Conversations/src/Generated/Models/ConversationPiiResults.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.cs new file mode 100644 index 0000000000000..f6b1252151584 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPiiResults.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.Conversations.Models +{ + /// The result from PII detection and redaction operation for each conversation. + public partial class ConversationPiiResults + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// array of conversations. + /// , or is null. + internal ConversationPiiResults(IEnumerable errors, string modelVersion, IEnumerable conversations) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(conversations, nameof(conversations)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Conversations = conversations.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// statistics. + /// This field indicates which model is used for scoring. + /// array of conversations. + /// Keeps track of any properties unknown to the library. + internal ConversationPiiResults(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList conversations, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Conversations = conversations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationPiiResults() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// statistics. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// array of conversations. + public IReadOnlyList Conversations { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.Serialization.cs new file mode 100644 index 0000000000000..5075509e40991 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.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.Conversations.Models +{ + public partial class ConversationPrediction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationPrediction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("intents"u8); + writer.WriteStartArray(); + foreach (var item in Intents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("projectKind"u8); + writer.WriteStringValue(ProjectKind.ToString()); + if (Optional.IsDefined(TopIntent)) + { + writer.WritePropertyName("topIntent"u8); + writer.WriteStringValue(TopIntent); + } + 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 + } + } + writer.WriteEndObject(); + } + + ConversationPrediction 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(ConversationPrediction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationPrediction(document.RootElement, options); + } + + internal static ConversationPrediction DeserializeConversationPrediction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList intents = default; + IReadOnlyList entities = default; + ProjectKind projectKind = default; + string topIntent = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("intents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationIntent.DeserializeConversationIntent(item, options)); + } + intents = array; + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationEntity.DeserializeConversationEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("projectKind"u8)) + { + projectKind = new ProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("topIntent"u8)) + { + topIntent = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationPrediction(projectKind, topIntent, serializedAdditionalRawData, intents, entities); + } + + 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(ConversationPrediction)} does not support writing '{options.Format}' format."); + } + } + + ConversationPrediction 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 DeserializeConversationPrediction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationPrediction)} 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 ConversationPrediction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationPrediction(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.Conversations/src/Generated/Models/ConversationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.cs new file mode 100644 index 0000000000000..929f675014a42 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationPrediction.cs @@ -0,0 +1,53 @@ +// 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.Conversations.Models +{ + /// Represents the prediction section of a Conversation project. + public partial class ConversationPrediction : PredictionBase + { + /// Initializes a new instance of . + /// The intent classification results. + /// The entity extraction results. + /// or is null. + internal ConversationPrediction(IEnumerable intents, IEnumerable entities) + { + Argument.AssertNotNull(intents, nameof(intents)); + Argument.AssertNotNull(entities, nameof(entities)); + + ProjectKind = ProjectKind.Conversation; + Intents = intents.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// The type of the project. + /// The intent with the highest score. + /// Keeps track of any properties unknown to the library. + /// The intent classification results. + /// The entity extraction results. + internal ConversationPrediction(ProjectKind projectKind, string topIntent, IDictionary serializedAdditionalRawData, IReadOnlyList intents, IReadOnlyList entities) : base(projectKind, topIntent, serializedAdditionalRawData) + { + Intents = intents; + Entities = entities; + } + + /// Initializes a new instance of for deserialization. + internal ConversationPrediction() + { + } + + /// The intent classification results. + public IReadOnlyList Intents { get; } + /// The entity extraction results. + public IReadOnlyList Entities { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.Serialization.cs new file mode 100644 index 0000000000000..69576df735352 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.Serialization.cs @@ -0,0 +1,191 @@ +// 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.Conversations.Models +{ + public partial class ConversationRequestStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationRequestStatistics)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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); + writer.WritePropertyName("conversationsCount"u8); + writer.WriteNumberValue(ConversationsCount); + writer.WritePropertyName("validConversationsCount"u8); + writer.WriteNumberValue(ValidConversationsCount); + writer.WritePropertyName("erroneousConversationsCount"u8); + writer.WriteNumberValue(ErroneousConversationsCount); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationRequestStatistics 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(ConversationRequestStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationRequestStatistics(document.RootElement, options); + } + + internal static ConversationRequestStatistics DeserializeConversationRequestStatistics(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; + int conversationsCount = default; + int validConversationsCount = default; + int erroneousConversationsCount = 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 (property.NameEquals("conversationsCount"u8)) + { + conversationsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("validConversationsCount"u8)) + { + validConversationsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("erroneousConversationsCount"u8)) + { + erroneousConversationsCount = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationRequestStatistics( + documentsCount, + validDocumentsCount, + erroneousDocumentsCount, + transactionsCount, + conversationsCount, + validConversationsCount, + erroneousConversationsCount, + 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(ConversationRequestStatistics)} does not support writing '{options.Format}' format."); + } + } + + ConversationRequestStatistics 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 DeserializeConversationRequestStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationRequestStatistics)} 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 ConversationRequestStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationRequestStatistics(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.Conversations/src/Generated/Models/ConversationRequestStatistics.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.cs new file mode 100644 index 0000000000000..88f7b0194c54e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationRequestStatistics.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// if showStats=true was specified in the request, this field contains information about the request payload. + public partial class ConversationRequestStatistics + { + /// + /// 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. + /// Number of conversations submitted in the request. + /// Number of conversation documents. This excludes documents that are empty, over the size limit, or in unsupported languages. + /// Number of invalid documents. This includes documents that are empty, over the size limit, or in unsupported languages. + internal ConversationRequestStatistics(int documentsCount, int validDocumentsCount, int erroneousDocumentsCount, long transactionsCount, int conversationsCount, int validConversationsCount, int erroneousConversationsCount) + { + DocumentsCount = documentsCount; + ValidDocumentsCount = validDocumentsCount; + ErroneousDocumentsCount = erroneousDocumentsCount; + TransactionsCount = transactionsCount; + ConversationsCount = conversationsCount; + ValidConversationsCount = validConversationsCount; + ErroneousConversationsCount = erroneousConversationsCount; + } + + /// 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. + /// Number of conversations submitted in the request. + /// Number of conversation documents. This excludes documents that are empty, over the size limit, or in unsupported languages. + /// Number of invalid documents. This includes documents that are empty, over the size limit, or in unsupported languages. + /// Keeps track of any properties unknown to the library. + internal ConversationRequestStatistics(int documentsCount, int validDocumentsCount, int erroneousDocumentsCount, long transactionsCount, int conversationsCount, int validConversationsCount, int erroneousConversationsCount, IDictionary serializedAdditionalRawData) + { + DocumentsCount = documentsCount; + ValidDocumentsCount = validDocumentsCount; + ErroneousDocumentsCount = erroneousDocumentsCount; + TransactionsCount = transactionsCount; + ConversationsCount = conversationsCount; + ValidConversationsCount = validConversationsCount; + ErroneousConversationsCount = erroneousConversationsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationRequestStatistics() + { + } + + /// 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; } + /// Number of conversations submitted in the request. + public int ConversationsCount { get; } + /// Number of conversation documents. This excludes documents that are empty, over the size limit, or in unsupported languages. + public int ValidConversationsCount { get; } + /// Number of invalid documents. This includes documents that are empty, over the size limit, or in unsupported languages. + public int ErroneousConversationsCount { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.Serialization.cs new file mode 100644 index 0000000000000..60a5812a4d5cc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.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.Conversations.Models +{ + public partial class ConversationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteStringValue(DetectedLanguage); + } + if (Optional.IsDefined(Prediction)) + { + writer.WritePropertyName("prediction"u8); + writer.WriteObjectValue(Prediction, 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 + } + } + writer.WriteEndObject(); + } + + ConversationResult 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(ConversationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationResult(document.RootElement, options); + } + + internal static ConversationResult DeserializeConversationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string query = default; + string detectedLanguage = default; + ConversationPrediction prediction = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + detectedLanguage = property.Value.GetString(); + continue; + } + if (property.NameEquals("prediction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + prediction = ConversationPrediction.DeserializeConversationPrediction(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationResult(query, detectedLanguage, prediction, 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(ConversationResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationResult 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 DeserializeConversationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationResult)} 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 ConversationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationResult(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.Conversations/src/Generated/Models/ConversationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.cs new file mode 100644 index 0000000000000..13646721d8e40 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationResult.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The response returned by a Conversation project. + public partial class ConversationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The same query given in request. + /// is null. + internal ConversationResult(string query) + { + Argument.AssertNotNull(query, nameof(query)); + + Query = query; + } + + /// Initializes a new instance of . + /// The same query given in request. + /// The detected language from the query in BCP 47 language representation. + /// The predicted result for the query. + /// Keeps track of any properties unknown to the library. + internal ConversationResult(string query, string detectedLanguage, ConversationPrediction prediction, IDictionary serializedAdditionalRawData) + { + Query = query; + DetectedLanguage = detectedLanguage; + Prediction = prediction; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationResult() + { + } + + /// The same query given in request. + public string Query { get; } + /// The detected language from the query in BCP 47 language representation. + public string DetectedLanguage { get; } + /// The predicted result for the query. + public ConversationPrediction Prediction { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.Serialization.cs new file mode 100644 index 0000000000000..5455b2130b7b7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class ConversationStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationStatistics)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationStatistics 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(ConversationStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationStatistics(document.RootElement, options); + } + + internal static ConversationStatistics DeserializeConversationStatistics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int transactionsCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + 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 ConversationStatistics(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(ConversationStatistics)} does not support writing '{options.Format}' format."); + } + } + + ConversationStatistics 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 DeserializeConversationStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationStatistics)} 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 ConversationStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationStatistics(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.Conversations/src/Generated/Models/ConversationStatistics.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.cs new file mode 100644 index 0000000000000..97887af17301c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationStatistics.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// If showStats=true was specified in the request, this field contains information about the conversation payload. + public partial class ConversationStatistics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of text units for the request. + internal ConversationStatistics(int transactionsCount) + { + TransactionsCount = transactionsCount; + } + + /// Initializes a new instance of . + /// Number of text units for the request. + /// Keeps track of any properties unknown to the library. + internal ConversationStatistics(int transactionsCount, IDictionary serializedAdditionalRawData) + { + TransactionsCount = transactionsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationStatistics() + { + } + + /// Number of text units for the request. + public int TransactionsCount { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.Serialization.cs new file mode 100644 index 0000000000000..530c81f4f9855 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.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.Conversations.Models +{ + public partial class ConversationSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationSummarizationActionContent)} does not support writing '{format}' format."); + } + + 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); + 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()); + } + writer.WritePropertyName("summaryAspects"u8); + writer.WriteStartArray(); + foreach (var item in SummaryAspects) + { + writer.WriteStringValue(item.ToString()); + } + 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 + } + } + writer.WriteEndObject(); + } + + ConversationSummarizationActionContent 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(ConversationSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationSummarizationActionContent(document.RootElement, options); + } + + internal static ConversationSummarizationActionContent DeserializeConversationSummarizationActionContent(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; + IList summaryAspects = 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("summaryAspects"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new SummaryAspect(item.GetString())); + } + summaryAspects = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationSummarizationActionContent( + loggingOptOut, + modelVersion, + sentenceCount, + stringIndexType, + summaryLength, + summaryAspects, + 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(ConversationSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + ConversationSummarizationActionContent 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 DeserializeConversationSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationSummarizationActionContent)} 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 ConversationSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationSummarizationActionContent(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.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs new file mode 100644 index 0000000000000..30e6964d75844 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationSummarizationActionContent.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Supported parameters for pre-build conversational summarization task. + public partial class ConversationSummarizationActionContent + { + /// + /// 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 . + /// Array of Summary Aspects. + /// is null. + public ConversationSummarizationActionContent(IEnumerable summaryAspects) + { + Argument.AssertNotNull(summaryAspects, nameof(summaryAspects)); + + SummaryAspects = summaryAspects.ToList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// It 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. + /// Array of Summary Aspects. + /// Keeps track of any properties unknown to the library. + internal ConversationSummarizationActionContent(bool? loggingOptOut, string modelVersion, int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, IList summaryAspects, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + SummaryAspects = summaryAspects; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationSummarizationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// It 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; } + /// Array of Summary Aspects. + public IList SummaryAspects { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.Serialization.cs new file mode 100644 index 0000000000000..91c6aae49af6c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.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.Conversations.Models +{ + public partial class ConversationTargetIntentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationTargetIntentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationTargetIntentResult 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(ConversationTargetIntentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationTargetIntentResult(document.RootElement, options); + } + + internal static ConversationTargetIntentResult DeserializeConversationTargetIntentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationResult result = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = ConversationResult.DeserializeConversationResult(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationTargetIntentResult(targetProjectKind, apiVersion, confidenceScore, serializedAdditionalRawData, result); + } + + 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(ConversationTargetIntentResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationTargetIntentResult 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 DeserializeConversationTargetIntentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationTargetIntentResult)} 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 ConversationTargetIntentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationTargetIntentResult(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.Conversations/src/Generated/Models/ConversationTargetIntentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.cs new file mode 100644 index 0000000000000..bddf9f7f04eff --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationTargetIntentResult.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A wrap up of Conversation project response. + public partial class ConversationTargetIntentResult : TargetIntentResult + { + /// Initializes a new instance of . + /// The prediction score and it ranges from 0.0 to 1.0. + internal ConversationTargetIntentResult(double confidence) : base(confidence) + { + TargetProjectKind = TargetProjectKind.Conversation; + } + + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + /// The actual response from a Conversation project. + internal ConversationTargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, IDictionary serializedAdditionalRawData, ConversationResult result) : base(targetProjectKind, apiVersion, confidence, serializedAdditionalRawData) + { + Result = result; + } + + /// Initializes a new instance of for deserialization. + internal ConversationTargetIntentResult() + { + } + + /// The actual response from a Conversation project. + public ConversationResult Result { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.Serialization.cs new file mode 100644 index 0000000000000..32c1fa71f2943 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class ConversationalInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationalInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(ConversationInput, options); + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + 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 + } + } + writer.WriteEndObject(); + } + + ConversationalInput 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(ConversationalInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalInput(document.RootElement, options); + } + + internal static ConversationalInput DeserializeConversationalInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationAnalysisInput analysisInput = default; + ConversationActionContent parameters = default; + AnalyzeConversationInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + analysisInput = ConversationAnalysisInput.DeserializeConversationAnalysisInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + parameters = ConversationActionContent.DeserializeConversationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationalInput)} does not support writing '{options.Format}' format."); + } + } + + ConversationalInput 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 DeserializeConversationalInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalInput)} 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 ConversationalInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationalInput(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.Conversations/src/Generated/Models/ConversationalInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.cs new file mode 100644 index 0000000000000..2d584178b42de --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalInput.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The input for a custom conversation task. + internal partial class ConversationalInput : AnalyzeConversationInput + { + /// Initializes a new instance of . + /// The input ConversationItem and its optional parameters. + /// Input parameters necessary for a Conversation task. + /// or is null. + public ConversationalInput(ConversationAnalysisInput conversationInput, ConversationActionContent actionContent) + { + Argument.AssertNotNull(conversationInput, nameof(conversationInput)); + Argument.AssertNotNull(actionContent, nameof(actionContent)); + + Kind = AnalyzeConversationInputKind.Conversation; + ConversationInput = conversationInput; + ActionContent = actionContent; + } + + /// Initializes a new instance of . + /// The base class of a conversation input task. + /// Keeps track of any properties unknown to the library. + /// The input ConversationItem and its optional parameters. + /// Input parameters necessary for a Conversation task. + internal ConversationalInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData, ConversationAnalysisInput conversationInput, ConversationActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + ConversationInput = conversationInput; + ActionContent = actionContent; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalInput() + { + } + + /// The input ConversationItem and its optional parameters. + public ConversationAnalysisInput ConversationInput { get; } + /// Input parameters necessary for a Conversation task. + public ConversationActionContent ActionContent { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.Serialization.cs new file mode 100644 index 0000000000000..d03137e21c8e4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.Serialization.cs @@ -0,0 +1,186 @@ +// 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.Conversations.Models +{ + public partial class ConversationalPiiResultWithResultBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationalPiiResultWithResultBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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("conversationItems"u8); + writer.WriteStartArray(); + foreach (var item in ConversationItems) + { + 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 + } + } + writer.WriteEndObject(); + } + + ConversationalPiiResultWithResultBase 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(ConversationalPiiResultWithResultBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationalPiiResultWithResultBase(document.RootElement, options); + } + + internal static ConversationalPiiResultWithResultBase DeserializeConversationalPiiResultWithResultBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + ConversationStatistics statistics = default; + IReadOnlyList conversationItems = 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(InputWarning.DeserializeInputWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = ConversationStatistics.DeserializeConversationStatistics(property.Value, options); + continue; + } + if (property.NameEquals("conversationItems"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationPiiItemResult.DeserializeConversationPiiItemResult(item, options)); + } + conversationItems = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationalPiiResultWithResultBase(id, warnings, statistics, conversationItems, 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(ConversationalPiiResultWithResultBase)} does not support writing '{options.Format}' format."); + } + } + + ConversationalPiiResultWithResultBase 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 DeserializeConversationalPiiResultWithResultBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationalPiiResultWithResultBase)} 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 ConversationalPiiResultWithResultBase FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationalPiiResultWithResultBase(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.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.cs new file mode 100644 index 0000000000000..5b8afd81c00b0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationalPiiResultWithResultBase.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.Conversations.Models +{ + /// Conversation PII result item. + public partial class ConversationalPiiResultWithResultBase + { + /// + /// 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 conversation identifier. + /// Warnings encountered in processing the document. + /// List of conversationItems. + /// , or is null. + internal ConversationalPiiResultWithResultBase(string id, IEnumerable warnings, IEnumerable conversationItems) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(conversationItems, nameof(conversationItems)); + + Id = id; + Warnings = warnings.ToList(); + ConversationItems = conversationItems.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty conversation identifier. + /// Warnings encountered in processing the document. + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + /// List of conversationItems. + /// Keeps track of any properties unknown to the library. + internal ConversationalPiiResultWithResultBase(string id, IReadOnlyList warnings, ConversationStatistics statistics, IReadOnlyList conversationItems, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + ConversationItems = conversationItems; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationalPiiResultWithResultBase() + { + } + + /// Unique, non-empty conversation identifier. + public string Id { get; } + /// Warnings encountered in processing the document. + public IReadOnlyList Warnings { get; } + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + public ConversationStatistics Statistics { get; } + /// List of conversationItems. + public IReadOnlyList ConversationItems { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.Serialization.cs new file mode 100644 index 0000000000000..dbd9da962fe07 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.Serialization.cs @@ -0,0 +1,186 @@ +// 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.Conversations.Models +{ + public partial class ConversationsSummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationsSummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("summaries"u8); + writer.WriteStartArray(); + foreach (var item in Summaries) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (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 + } + } + writer.WriteEndObject(); + } + + ConversationsSummaryResult 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(ConversationsSummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationsSummaryResult(document.RootElement, options); + } + + internal static ConversationsSummaryResult DeserializeConversationsSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + ConversationStatistics statistics = default; + IReadOnlyList summaries = 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(InputWarning.DeserializeInputWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = ConversationStatistics.DeserializeConversationStatistics(property.Value, options); + continue; + } + if (property.NameEquals("summaries"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SummaryResultItem.DeserializeSummaryResultItem(item, options)); + } + summaries = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationsSummaryResult(id, warnings, statistics, summaries, 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(ConversationsSummaryResult)} does not support writing '{options.Format}' format."); + } + } + + ConversationsSummaryResult 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 DeserializeConversationsSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationsSummaryResult)} 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 ConversationsSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeConversationsSummaryResult(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.Conversations/src/Generated/Models/ConversationsSummaryResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.cs new file mode 100644 index 0000000000000..46d024aaaeec7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ConversationsSummaryResult.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.Conversations.Models +{ + /// Conversations Summary Result. + public partial class ConversationsSummaryResult + { + /// + /// 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 conversation identifier. + /// Warnings encountered in processing the document. + /// array of summaries. + /// , or is null. + internal ConversationsSummaryResult(string id, IEnumerable warnings, IEnumerable summaries) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(summaries, nameof(summaries)); + + Id = id; + Warnings = warnings.ToList(); + Summaries = summaries.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty conversation identifier. + /// Warnings encountered in processing the document. + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + /// array of summaries. + /// Keeps track of any properties unknown to the library. + internal ConversationsSummaryResult(string id, IReadOnlyList warnings, ConversationStatistics statistics, IReadOnlyList summaries, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Summaries = summaries; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationsSummaryResult() + { + } + + /// Unique, non-empty conversation identifier. + public string Id { get; } + /// Warnings encountered in processing the document. + public IReadOnlyList Warnings { get; } + /// If showStats=true was specified in the request this field will contain information about the conversation payload. + public ConversationStatistics Statistics { get; } + /// array of summaries. + public IReadOnlyList Summaries { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.Serialization.cs new file mode 100644 index 0000000000000..73ceb10778d74 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.Serialization.cs @@ -0,0 +1,162 @@ +// 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.Conversations.Models +{ + public partial class CurrencyResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrencyResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Iso4217)) + { + writer.WritePropertyName("ISO4217"u8); + writer.WriteStringValue(Iso4217); + } + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + CurrencyResolution 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(CurrencyResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCurrencyResolution(document.RootElement, options); + } + + internal static CurrencyResolution DeserializeCurrencyResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string isO4217 = default; + double value = default; + string unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ISO4217"u8)) + { + isO4217 = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CurrencyResolution(resolutionKind, serializedAdditionalRawData, isO4217, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CurrencyResolution)} does not support writing '{options.Format}' format."); + } + } + + CurrencyResolution 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 DeserializeCurrencyResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CurrencyResolution)} 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 CurrencyResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCurrencyResolution(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.Conversations/src/Generated/Models/CurrencyResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.cs new file mode 100644 index 0000000000000..5cab42078cda3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CurrencyResolution.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the currency entity resolution model. + public partial class CurrencyResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The money amount captured in the extracted entity. + /// The unit of the amount captured in the extracted entity. + /// is null. + internal CurrencyResolution(double value, string unit) + { + Argument.AssertNotNull(unit, nameof(unit)); + + ResolutionKind = ResolutionKind.CurrencyResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + /// The money amount captured in the extracted entity. + /// The unit of the amount captured in the extracted entity. + internal CurrencyResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, string iso4217, double value, string unit) : base(resolutionKind, serializedAdditionalRawData) + { + Iso4217 = iso4217; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal CurrencyResolution() + { + } + + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + public string Iso4217 { get; } + /// The money amount captured in the extracted entity. + public double Value { get; } + /// The unit of the amount captured in the extracted entity. + public string Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.Serialization.cs new file mode 100644 index 0000000000000..65683c94a2a72 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.Serialization.cs @@ -0,0 +1,229 @@ +// 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.Conversations.Models +{ + public partial class CustomConversationSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomConversationSummarizationActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(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()); + } + writer.WritePropertyName("summaryAspects"u8); + writer.WriteStartArray(); + foreach (var item in SummaryAspects) + { + writer.WriteStringValue(item.ToString()); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomConversationSummarizationActionContent 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(CustomConversationSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomConversationSummarizationActionContent(document.RootElement, options); + } + + internal static CustomConversationSummarizationActionContent DeserializeCustomConversationSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + int? sentenceCount = default; + StringIndexType? stringIndexType = default; + SummaryLengthBucket? summaryLength = default; + IList summaryAspects = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("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("summaryAspects"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new SummaryAspect(item.GetString())); + } + summaryAspects = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomConversationSummarizationActionContent( + loggingOptOut, + projectName, + deploymentName, + sentenceCount, + stringIndexType, + summaryLength, + summaryAspects, + 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(CustomConversationSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomConversationSummarizationActionContent 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 DeserializeCustomConversationSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomConversationSummarizationActionContent)} 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 CustomConversationSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomConversationSummarizationActionContent(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.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.cs new file mode 100644 index 0000000000000..6b920abff86f1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomConversationSummarizationActionContent.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Supported parameters for a custom conversation summarization task. + public partial class CustomConversationSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Array of Summary Aspects. + /// , or is null. + public CustomConversationSummarizationActionContent(string projectName, string deploymentName, IEnumerable summaryAspects) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(summaryAspects, nameof(summaryAspects)); + + ProjectName = projectName; + DeploymentName = deploymentName; + SummaryAspects = summaryAspects.ToList(); + } + + /// 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. + /// It controls the approximate number of sentences in the output summaries. + /// String index type. + /// Controls the approximate length of the output summaries. Recommended to use summaryLength over sentenceCount. + /// Array of Summary Aspects. + /// Keeps track of any properties unknown to the library. + internal CustomConversationSummarizationActionContent(bool? loggingOptOut, string projectName, string deploymentName, int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, IList summaryAspects, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + SummaryAspects = summaryAspects; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomConversationSummarizationActionContent() + { + } + + /// 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; } + /// It controls the approximate number of sentences in the output summaries. + public int? SentenceCount { get; set; } + /// String index type. + public StringIndexType? StringIndexType { get; set; } + /// Controls the approximate length of the output summaries. Recommended to use summaryLength over sentenceCount. + public SummaryLengthBucket? SummaryLength { get; set; } + /// Array of Summary Aspects. + public IList SummaryAspects { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..341ebd86c039f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.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.Conversations.Models +{ + public partial class CustomSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSummarizationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomSummarizationOperationAction 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(CustomSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSummarizationOperationAction(document.RootElement, options); + } + + internal static CustomSummarizationOperationAction DeserializeCustomSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomConversationSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeConversationOperationActionKind 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 = CustomConversationSummarizationActionContent.DeserializeCustomConversationSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSummarizationOperationAction(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(CustomSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomSummarizationOperationAction 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 DeserializeCustomSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSummarizationOperationAction)} 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 CustomSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSummarizationOperationAction(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.Conversations/src/Generated/Models/CustomSummarizationOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.cs new file mode 100644 index 0000000000000..f8307473f2802 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationAction.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.Conversations.Models +{ + /// Task definition for custom conversational summarization. + public partial class CustomSummarizationOperationAction : AnalyzeConversationOperationAction + { + /// Initializes a new instance of . + public CustomSummarizationOperationAction() + { + Kind = AnalyzeConversationOperationActionKind.CustomConversationalSummarizationTask; + } + + /// Initializes a new instance of . + /// task name. + /// Enumeration of supported analysis tasks on a collection of conversations. + /// Keeps track of any properties unknown to the library. + /// parameters. + internal CustomSummarizationOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomConversationSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// parameters. + public CustomConversationSummarizationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..224b27e9d0566 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// 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.Conversations.Models +{ + public partial class CustomSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSummarizationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSummarizationOperationResult 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(CustomSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSummarizationOperationResult(document.RootElement, options); + } + + internal static CustomSummarizationOperationResult DeserializeCustomSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSummaryResult results = default; + DateTimeOffset lastUpdateDateTime = default; + ConversationActionState status = default; + string taskName = default; + AnalyzeConversationOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomSummaryResult.DeserializeCustomSummaryResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new ConversationActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSummarizationOperationResult( + 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(CustomSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSummarizationOperationResult 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 DeserializeCustomSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSummarizationOperationResult)} 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 CustomSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSummarizationOperationResult(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.Conversations/src/Generated/Models/CustomSummarizationOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.cs new file mode 100644 index 0000000000000..5495c278aa483 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummarizationOperationResult.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.Conversations.Models +{ + /// Result for the custom summarization task on the conversation. + public partial class CustomSummarizationOperationResult : AnalyzeConversationOperationResult + { + /// 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. + /// Custom Summary Result. + /// is null. + internal CustomSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, CustomSummaryResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeConversationOperationResultsKind.CustomSummarizationOperationResults; + 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. + /// discriminator kind. + /// Keeps track of any properties unknown to the library. + /// Custom Summary Result. + internal CustomSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, string name, AnalyzeConversationOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomSummaryResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomSummarizationOperationResult() + { + } + + /// Custom Summary Result. + public CustomSummaryResult Results { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.Serialization.cs new file mode 100644 index 0000000000000..aa5e660ac44a8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.Serialization.cs @@ -0,0 +1,200 @@ +// 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.Conversations.Models +{ + public partial class CustomSummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("conversations"u8); + writer.WriteStartArray(); + foreach (var item in Conversations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSummaryResult 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(CustomSummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSummaryResult(document.RootElement, options); + } + + internal static CustomSummaryResult DeserializeCustomSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList conversations = default; + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationsSummaryResult.DeserializeConversationsSummaryResult(item, options)); + } + conversations = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSummaryResult( + conversations, + errors, + statistics, + projectName, + deploymentName, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSummaryResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSummaryResult 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 DeserializeCustomSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSummaryResult)} 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 CustomSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSummaryResult(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.Conversations/src/Generated/Models/CustomSummaryResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.cs new file mode 100644 index 0000000000000..32b95eb66c261 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/CustomSummaryResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Custom Summary Results. + public partial class CustomSummaryResult + { + /// + /// 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 . + /// array of conversations. + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// , , or is null. + internal CustomSummaryResult(IEnumerable conversations, IEnumerable errors, string projectName, string deploymentName) + { + Argument.AssertNotNull(conversations, nameof(conversations)); + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + Conversations = conversations.ToList(); + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// array of conversations. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomSummaryResult(IReadOnlyList conversations, IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + Conversations = conversations; + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSummaryResult() + { + } + + /// array of conversations. + public IReadOnlyList Conversations { get; } + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.Serialization.cs new file mode 100644 index 0000000000000..69cb62a6ea859 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class DateTimeResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateTimeResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("timex"u8); + writer.WriteStringValue(Timex); + writer.WritePropertyName("dateTimeSubKind"u8); + writer.WriteStringValue(DateTimeSubKind.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + if (Optional.IsDefined(Modifier)) + { + writer.WritePropertyName("modifier"u8); + writer.WriteStringValue(Modifier.Value.ToString()); + } + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + DateTimeResolution 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(DateTimeResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateTimeResolution(document.RootElement, options); + } + + internal static DateTimeResolution DeserializeDateTimeResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string timex = default; + DateTimeSubKind dateTimeSubKind = default; + string value = default; + TemporalModifier? modifier = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timex"u8)) + { + timex = property.Value.GetString(); + continue; + } + if (property.NameEquals("dateTimeSubKind"u8)) + { + dateTimeSubKind = new DateTimeSubKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("modifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifier = new TemporalModifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateTimeResolution( + resolutionKind, + serializedAdditionalRawData, + timex, + dateTimeSubKind, + value, + modifier); + } + + 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(DateTimeResolution)} does not support writing '{options.Format}' format."); + } + } + + DateTimeResolution 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 DeserializeDateTimeResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateTimeResolution)} 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 DateTimeResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateTimeResolution(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.Conversations/src/Generated/Models/DateTimeResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.cs new file mode 100644 index 0000000000000..744001b155ba9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeResolution.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A resolution for datetime entity instances. + public partial class DateTimeResolution : ResolutionBase + { + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The DateTime SubKind. + /// The actual time that the extracted text denote. + /// or is null. + internal DateTimeResolution(string timex, DateTimeSubKind dateTimeSubKind, string value) + { + Argument.AssertNotNull(timex, nameof(timex)); + Argument.AssertNotNull(value, nameof(value)); + + ResolutionKind = ResolutionKind.DateTimeResolution; + Timex = timex; + DateTimeSubKind = dateTimeSubKind; + Value = value; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The DateTime SubKind. + /// The actual time that the extracted text denote. + /// An optional modifier of a date/time instance. + internal DateTimeResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, string timex, DateTimeSubKind dateTimeSubKind, string value, TemporalModifier? modifier) : base(resolutionKind, serializedAdditionalRawData) + { + Timex = timex; + DateTimeSubKind = dateTimeSubKind; + Value = value; + Modifier = modifier; + } + + /// Initializes a new instance of for deserialization. + internal DateTimeResolution() + { + } + + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + public string Timex { get; } + /// The DateTime SubKind. + public DateTimeSubKind DateTimeSubKind { get; } + /// The actual time that the extracted text denote. + public string Value { get; } + /// An optional modifier of a date/time instance. + public TemporalModifier? Modifier { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeSubKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeSubKind.cs new file mode 100644 index 0000000000000..c79d11e089645 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DateTimeSubKind.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The Datetime SubKind. + public readonly partial struct DateTimeSubKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DateTimeSubKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TimeValue = "Time"; + private const string DateValue = "Date"; + private const string DateTimeValue = "DateTime"; + private const string DurationValue = "Duration"; + private const string SetValue = "Set"; + + /// Time subkind. + public static DateTimeSubKind Time { get; } = new DateTimeSubKind(TimeValue); + /// Date subkind. + public static DateTimeSubKind Date { get; } = new DateTimeSubKind(DateValue); + /// DateTime subkind. + public static DateTimeSubKind DateTime { get; } = new DateTimeSubKind(DateTimeValue); + /// Duration subkind. + public static DateTimeSubKind Duration { get; } = new DateTimeSubKind(DurationValue); + /// Set subkind. + public static DateTimeSubKind Set { get; } = new DateTimeSubKind(SetValue); + /// Determines if two values are the same. + public static bool operator ==(DateTimeSubKind left, DateTimeSubKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DateTimeSubKind left, DateTimeSubKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DateTimeSubKind(string value) => new DateTimeSubKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DateTimeSubKind other && Equals(other); + /// + public bool Equals(DateTimeSubKind 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.Conversations/src/Generated/Models/DocumentError.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.Serialization.cs new file mode 100644 index 0000000000000..97fedb22db168 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.Serialization.cs @@ -0,0 +1,143 @@ +// 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.Conversations.Models +{ + public partial class DocumentError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentError)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + DocumentError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentError(document.RootElement, options); + } + + internal static DocumentError DeserializeDocumentError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + ConversationError 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 = ConversationError.DeserializeConversationError(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentError(id, error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentError)} does not support writing '{options.Format}' format."); + } + } + + DocumentError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.cs new file mode 100644 index 0000000000000..9a2986c56fe51 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/DocumentError.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Contains details of errors encountered during a job execution. + public partial class DocumentError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// or is null. + internal DocumentError(string id, ConversationError error) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(error, nameof(error)); + + Id = id; + Error = error; + } + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// Keeps track of any properties unknown to the library. + internal DocumentError(string id, ConversationError error, IDictionary serializedAdditionalRawData) + { + Id = id; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentError() + { + } + + /// The ID of the input document. + public string Id { get; } + /// Error encountered. + public ConversationError Error { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.Serialization.cs new file mode 100644 index 0000000000000..6742256bab8b3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class EntitySubtype : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitySubtype)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartArray(); + foreach (var item in Tags) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("extraInformationKind"u8); + writer.WriteStringValue(ExtraInformationKind.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 + } + } + writer.WriteEndObject(); + } + + EntitySubtype 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(EntitySubtype)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitySubtype(document.RootElement, options); + } + + internal static EntitySubtype DeserializeEntitySubtype(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + IReadOnlyList tags = default; + ExtraInformationKind extraInformationKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityTag.DeserializeEntityTag(item, options)); + } + tags = array; + continue; + } + if (property.NameEquals("extraInformationKind"u8)) + { + extraInformationKind = new ExtraInformationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitySubtype(extraInformationKind, serializedAdditionalRawData, value, tags ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitySubtype)} does not support writing '{options.Format}' format."); + } + } + + EntitySubtype 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 DeserializeEntitySubtype(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitySubtype)} 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 EntitySubtype FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitySubtype(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.Conversations/src/Generated/Models/EntitySubtype.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.cs new file mode 100644 index 0000000000000..d88fb9434754e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntitySubtype.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The concrete entity Subtype model of extra information. + public partial class EntitySubtype : ConversationEntityExtraInformation + { + /// Initializes a new instance of . + internal EntitySubtype() + { + ExtraInformationKind = ExtraInformationKind.EntitySubtype; + Tags = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The extra information object kind. + /// Keeps track of any properties unknown to the library. + /// The Subtype of an extracted entity type. + /// List of entity tags. Tags express similarities between entity categories for the extracted entity type. + internal EntitySubtype(ExtraInformationKind extraInformationKind, IDictionary serializedAdditionalRawData, string value, IReadOnlyList tags) : base(extraInformationKind, serializedAdditionalRawData) + { + Value = value; + Tags = tags; + } + + /// The Subtype of an extracted entity type. + public string Value { get; } + /// List of entity tags. Tags express similarities between entity categories for the extracted entity type. + public IReadOnlyList Tags { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.Serialization.cs new file mode 100644 index 0000000000000..725384570449a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.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.Conversations.Models +{ + public partial class EntityTag : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityTag)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(ConfidenceScore)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityTag IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityTag)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityTag(document.RootElement, options); + } + + internal static EntityTag DeserializeEntityTag(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + double? confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityTag(name, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityTag)} does not support writing '{options.Format}' format."); + } + } + + EntityTag IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityTag(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityTag)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityTag FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityTag(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.cs new file mode 100644 index 0000000000000..48d234743e0dc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/EntityTag.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Tags express similarities between entity categories for the extracted entity type. + public partial class EntityTag + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the tag. + /// is null. + internal EntityTag(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The name of the tag. + /// The confidence score of the tag for the extracted entity between 0.0 and 1.0. + /// Keeps track of any properties unknown to the library. + internal EntityTag(string name, double? confidenceScore, IDictionary serializedAdditionalRawData) + { + Name = name; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityTag() + { + } + + /// The name of the tag. + public string Name { get; } + /// The confidence score of the tag for the extracted entity between 0.0 and 1.0. + public double? ConfidenceScore { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ExtraInformationKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ExtraInformationKind.cs new file mode 100644 index 0000000000000..863aabecd35c7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ExtraInformationKind.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.Conversations.Models +{ + /// The extra information object kind. + internal readonly partial struct ExtraInformationKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExtraInformationKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EntitySubtypeValue = "EntitySubtype"; + private const string ListKeyValue = "ListKey"; + private const string RegexKeyValue = "RegexKey"; + + /// Entity subtype extra information kind. + public static ExtraInformationKind EntitySubtype { get; } = new ExtraInformationKind(EntitySubtypeValue); + /// List key extra information kind. + public static ExtraInformationKind ListKey { get; } = new ExtraInformationKind(ListKeyValue); + /// Regex key extra information kind. + public static ExtraInformationKind RegexKey { get; } = new ExtraInformationKind(RegexKeyValue); + /// Determines if two values are the same. + public static bool operator ==(ExtraInformationKind left, ExtraInformationKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExtraInformationKind left, ExtraInformationKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ExtraInformationKind(string value) => new ExtraInformationKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExtraInformationKind other && Equals(other); + /// + public bool Equals(ExtraInformationKind 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.Conversations/src/Generated/Models/InformationResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationResolution.Serialization.cs new file mode 100644 index 0000000000000..21b149226413f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class InformationResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InformationResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + InformationResolution 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(InformationResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInformationResolution(document.RootElement, options); + } + + internal static InformationResolution DeserializeInformationResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + InformationUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new InformationUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InformationResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InformationResolution)} does not support writing '{options.Format}' format."); + } + } + + InformationResolution 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 DeserializeInformationResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InformationResolution)} 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 InformationResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInformationResolution(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.Conversations/src/Generated/Models/InformationResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationResolution.cs new file mode 100644 index 0000000000000..cf3e1bf6ba1c6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the information (data) entity resolution model. + public partial class InformationResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The information (data) Unit of measurement. + internal InformationResolution(double value, InformationUnit unit) + { + ResolutionKind = ResolutionKind.InformationResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The information (data) Unit of measurement. + internal InformationResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, InformationUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal InformationResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The information (data) Unit of measurement. + public InformationUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationUnit.cs new file mode 100644 index 0000000000000..5e720b994afa9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InformationUnit.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The information (data) Unit of measurement. + public readonly partial struct InformationUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InformationUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string BitValue = "Bit"; + private const string KilobitValue = "Kilobit"; + private const string MegabitValue = "Megabit"; + private const string GigabitValue = "Gigabit"; + private const string TerabitValue = "Terabit"; + private const string PetabitValue = "Petabit"; + private const string ByteValue = "Byte"; + private const string KilobyteValue = "Kilobyte"; + private const string MegabyteValue = "Megabyte"; + private const string GigabyteValue = "Gigabyte"; + private const string TerabyteValue = "Terabyte"; + private const string PetabyteValue = "Petabyte"; + + /// Unspecified information unit. + public static InformationUnit Unspecified { get; } = new InformationUnit(UnspecifiedValue); + /// Bit information unit. + public static InformationUnit Bit { get; } = new InformationUnit(BitValue); + /// Kilobit information unit. + public static InformationUnit Kilobit { get; } = new InformationUnit(KilobitValue); + /// Megabit information unit. + public static InformationUnit Megabit { get; } = new InformationUnit(MegabitValue); + /// Gigabit information unit. + public static InformationUnit Gigabit { get; } = new InformationUnit(GigabitValue); + /// Terabit information unit. + public static InformationUnit Terabit { get; } = new InformationUnit(TerabitValue); + /// Petabit information unit. + public static InformationUnit Petabit { get; } = new InformationUnit(PetabitValue); + /// Byte information unit. + public static InformationUnit Byte { get; } = new InformationUnit(ByteValue); + /// Kilobyte information unit. + public static InformationUnit Kilobyte { get; } = new InformationUnit(KilobyteValue); + /// Megabyte information unit. + public static InformationUnit Megabyte { get; } = new InformationUnit(MegabyteValue); + /// Gigabyte information unit. + public static InformationUnit Gigabyte { get; } = new InformationUnit(GigabyteValue); + /// Terabyte information unit. + public static InformationUnit Terabyte { get; } = new InformationUnit(TerabyteValue); + /// Petabyte information unit. + public static InformationUnit Petabyte { get; } = new InformationUnit(PetabyteValue); + /// Determines if two values are the same. + public static bool operator ==(InformationUnit left, InformationUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InformationUnit left, InformationUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator InformationUnit(string value) => new InformationUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InformationUnit other && Equals(other); + /// + public bool Equals(InformationUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorCode.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorCode.cs new file mode 100644 index 0000000000000..7fd5954642615 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/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.Conversations.Models +{ + /// 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 string 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.Conversations/src/Generated/Models/InnerErrorModel.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorModel.Serialization.cs new file mode 100644 index 0000000000000..fdbef36d7d806 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorModel.Serialization.cs @@ -0,0 +1,201 @@ +// 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.Conversations.Models +{ + public partial class InnerErrorModel : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.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, 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 + } + } + writer.WriteEndObject(); + } + + 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.Conversations/src/Generated/Models/InnerErrorModel.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InnerErrorModel.cs new file mode 100644 index 0000000000000..8879fc347497a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/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.Conversations.Models +{ + /// 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.Conversations/src/Generated/Models/InputModality.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputModality.cs new file mode 100644 index 0000000000000..3829d0ce25190 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputModality.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.Conversations.Models +{ + /// Enumeration of supported conversational modalities. + public readonly partial struct InputModality : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InputModality(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TranscriptValue = "transcript"; + private const string TextValue = "text"; + + /// Transcript input modality. + public static InputModality Transcript { get; } = new InputModality(TranscriptValue); + /// Text input modality. + public static InputModality Text { get; } = new InputModality(TextValue); + /// Determines if two values are the same. + public static bool operator ==(InputModality left, InputModality right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InputModality left, InputModality right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator InputModality(string value) => new InputModality(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InputModality other && Equals(other); + /// + public bool Equals(InputModality 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.Conversations/src/Generated/Models/InputWarning.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputWarning.Serialization.cs new file mode 100644 index 0000000000000..7593de3ee5579 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputWarning.Serialization.cs @@ -0,0 +1,154 @@ +// 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.Conversations.Models +{ + public partial class InputWarning : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InputWarning)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + 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 + } + } + writer.WriteEndObject(); + } + + InputWarning 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(InputWarning)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInputWarning(document.RootElement, options); + } + + internal static InputWarning DeserializeInputWarning(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string 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 = 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 InputWarning(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(InputWarning)} does not support writing '{options.Format}' format."); + } + } + + InputWarning 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 DeserializeInputWarning(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InputWarning)} 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 InputWarning FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInputWarning(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.Conversations/src/Generated/Models/InputWarning.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputWarning.cs new file mode 100644 index 0000000000000..4b92dcb27ae60 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/InputWarning.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Contains details of warnings encountered during a job execution. + public partial class InputWarning + { + /// + /// 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. + /// or is null. + internal InputWarning(string code, string message) + { + Argument.AssertNotNull(code, nameof(code)); + 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 InputWarning(string code, string message, string targetRef, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + TargetRef = targetRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InputWarning() + { + } + + /// Warning code. + public string 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.Conversations/src/Generated/Models/ItemizedSummaryContext.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ItemizedSummaryContext.Serialization.cs new file mode 100644 index 0000000000000..f7e4398a2a994 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ItemizedSummaryContext.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class ItemizedSummaryContext : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ItemizedSummaryContext)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("conversationItemId"u8); + writer.WriteStringValue(ConversationItemId); + 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 + } + } + writer.WriteEndObject(); + } + + ItemizedSummaryContext 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(ItemizedSummaryContext)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeItemizedSummaryContext(document.RootElement, options); + } + + internal static ItemizedSummaryContext DeserializeItemizedSummaryContext(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int offset = default; + int length = default; + string conversationItemId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("conversationItemId"u8)) + { + conversationItemId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ItemizedSummaryContext(offset, length, conversationItemId, 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(ItemizedSummaryContext)} does not support writing '{options.Format}' format."); + } + } + + ItemizedSummaryContext 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 DeserializeItemizedSummaryContext(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ItemizedSummaryContext)} 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 ItemizedSummaryContext FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeItemizedSummaryContext(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.Conversations/src/Generated/Models/ItemizedSummaryContext.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ItemizedSummaryContext.cs new file mode 100644 index 0000000000000..1687e9756339d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ItemizedSummaryContext.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Context of the summary with a conversation item ID. + public partial class ItemizedSummaryContext + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// Reference to the ID of ConversationItem. + /// is null. + internal ItemizedSummaryContext(int offset, int length, string conversationItemId) + { + Argument.AssertNotNull(conversationItemId, nameof(conversationItemId)); + + Offset = offset; + Length = length; + ConversationItemId = conversationItemId; + } + + /// 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. + /// Reference to the ID of ConversationItem. + /// Keeps track of any properties unknown to the library. + internal ItemizedSummaryContext(int offset, int length, string conversationItemId, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Length = length; + ConversationItemId = conversationItemId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ItemizedSummaryContext() + { + } + + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Reference to the ID of ConversationItem. + public string ConversationItemId { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs new file mode 100644 index 0000000000000..ba9c974e12781 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.Serialization.cs @@ -0,0 +1,269 @@ +// 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.Conversations.Models +{ + public partial class KnowledgeBaseAnswer : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KnowledgeBaseAnswer)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Questions)) + { + writer.WritePropertyName("questions"u8); + writer.WriteStartArray(); + foreach (var item in Questions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Answer)) + { + writer.WritePropertyName("answer"u8); + writer.WriteStringValue(Answer); + } + if (Optional.IsDefined(Confidence)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence.Value); + } + if (Optional.IsDefined(QnaId)) + { + writer.WritePropertyName("id"u8); + writer.WriteNumberValue(QnaId.Value); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(Source); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Dialog)) + { + writer.WritePropertyName("dialog"u8); + writer.WriteObjectValue(Dialog, options); + } + if (Optional.IsDefined(ShortAnswer)) + { + writer.WritePropertyName("answerSpan"u8); + writer.WriteObjectValue(ShortAnswer, 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 + } + } + writer.WriteEndObject(); + } + + KnowledgeBaseAnswer 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(KnowledgeBaseAnswer)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswer(document.RootElement, options); + } + + internal static KnowledgeBaseAnswer DeserializeKnowledgeBaseAnswer(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList questions = default; + string answer = default; + double? confidenceScore = default; + int? id = default; + string source = default; + IReadOnlyDictionary metadata = default; + KnowledgeBaseAnswerDialog dialog = default; + AnswerSpan answerSpan = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("questions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + questions = array; + continue; + } + if (property.NameEquals("answer"u8)) + { + answer = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("source"u8)) + { + source = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"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()); + } + metadata = dictionary; + continue; + } + if (property.NameEquals("dialog"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dialog = KnowledgeBaseAnswerDialog.DeserializeKnowledgeBaseAnswerDialog(property.Value, options); + continue; + } + if (property.NameEquals("answerSpan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + answerSpan = AnswerSpan.DeserializeAnswerSpan(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KnowledgeBaseAnswer( + questions ?? new ChangeTrackingList(), + answer, + confidenceScore, + id, + source, + metadata ?? new ChangeTrackingDictionary(), + dialog, + answerSpan, + 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(KnowledgeBaseAnswer)} does not support writing '{options.Format}' format."); + } + } + + KnowledgeBaseAnswer 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 DeserializeKnowledgeBaseAnswer(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KnowledgeBaseAnswer)} 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 KnowledgeBaseAnswer FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKnowledgeBaseAnswer(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.Conversations/src/Generated/Models/KnowledgeBaseAnswer.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.cs new file mode 100644 index 0000000000000..f39cdc5d7f702 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswer.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents knowledge base answer. + public partial class KnowledgeBaseAnswer + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal KnowledgeBaseAnswer() + { + Questions = new ChangeTrackingList(); + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// List of questions associated with the answer. + /// Answer text. + /// Answer confidence score, value ranges from 0 to 1. + /// ID of the QnA result. + /// Source of QnA result. + /// Metadata associated with the answer, useful to categorize or filter question answers. + /// Dialog associated with Answer. + /// Answer span object of QnA with respect to user's question. + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswer(IReadOnlyList questions, string answer, double? confidence, int? qnaId, string source, IReadOnlyDictionary metadata, KnowledgeBaseAnswerDialog dialog, AnswerSpan shortAnswer, IDictionary serializedAdditionalRawData) + { + Questions = questions; + Answer = answer; + Confidence = confidence; + QnaId = qnaId; + Source = source; + Metadata = metadata; + Dialog = dialog; + ShortAnswer = shortAnswer; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of questions associated with the answer. + public IReadOnlyList Questions { get; } + /// Answer text. + public string Answer { get; } + /// Answer confidence score, value ranges from 0 to 1. + public double? Confidence { get; } + /// ID of the QnA result. + public int? QnaId { get; } + /// Source of QnA result. + public string Source { get; } + /// Metadata associated with the answer, useful to categorize or filter question answers. + public IReadOnlyDictionary Metadata { get; } + /// Dialog associated with Answer. + public KnowledgeBaseAnswerDialog Dialog { get; } + /// Answer span object of QnA with respect to user's question. + public AnswerSpan ShortAnswer { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs new file mode 100644 index 0000000000000..0dd33bcde23a6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.Serialization.cs @@ -0,0 +1,146 @@ +// 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.Conversations.Models +{ + internal partial class KnowledgeBaseAnswerContext : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KnowledgeBaseAnswerContext)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("previousQnaId"u8); + writer.WriteNumberValue(PreviousQnaId); + if (Optional.IsDefined(PreviousQuestion)) + { + writer.WritePropertyName("previousUserQuery"u8); + writer.WriteStringValue(PreviousQuestion); + } + 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 + } + } + writer.WriteEndObject(); + } + + KnowledgeBaseAnswerContext 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(KnowledgeBaseAnswerContext)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswerContext(document.RootElement, options); + } + + internal static KnowledgeBaseAnswerContext DeserializeKnowledgeBaseAnswerContext(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int previousQnaId = default; + string previousUserQuery = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("previousQnaId"u8)) + { + previousQnaId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("previousUserQuery"u8)) + { + previousUserQuery = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KnowledgeBaseAnswerContext(previousQnaId, previousUserQuery, 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(KnowledgeBaseAnswerContext)} does not support writing '{options.Format}' format."); + } + } + + KnowledgeBaseAnswerContext 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 DeserializeKnowledgeBaseAnswerContext(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KnowledgeBaseAnswerContext)} 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 KnowledgeBaseAnswerContext FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKnowledgeBaseAnswerContext(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.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.cs new file mode 100644 index 0000000000000..ba0a477089b67 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerContext.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Context object with previous QnA's information. + internal partial class KnowledgeBaseAnswerContext + { + /// + /// 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 . + /// Previous turn top answer result QnA ID. + public KnowledgeBaseAnswerContext(int previousQnaId) + { + PreviousQnaId = previousQnaId; + } + + /// Initializes a new instance of . + /// Previous turn top answer result QnA ID. + /// Previous user query. + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswerContext(int previousQnaId, string previousQuestion, IDictionary serializedAdditionalRawData) + { + PreviousQnaId = previousQnaId; + PreviousQuestion = previousQuestion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KnowledgeBaseAnswerContext() + { + } + + /// Previous turn top answer result QnA ID. + public int PreviousQnaId { get; } + /// Previous user query. + public string PreviousQuestion { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs new file mode 100644 index 0000000000000..c6b750935e181 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class KnowledgeBaseAnswerDialog : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KnowledgeBaseAnswerDialog)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(IsContextOnly)) + { + writer.WritePropertyName("isContextOnly"u8); + writer.WriteBooleanValue(IsContextOnly.Value); + } + if (Optional.IsCollectionDefined(Prompts)) + { + writer.WritePropertyName("prompts"u8); + writer.WriteStartArray(); + foreach (var item in Prompts) + { + 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 + } + } + writer.WriteEndObject(); + } + + KnowledgeBaseAnswerDialog 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(KnowledgeBaseAnswerDialog)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswerDialog(document.RootElement, options); + } + + internal static KnowledgeBaseAnswerDialog DeserializeKnowledgeBaseAnswerDialog(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? isContextOnly = default; + IReadOnlyList prompts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("isContextOnly"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isContextOnly = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("prompts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KnowledgeBaseAnswerPrompt.DeserializeKnowledgeBaseAnswerPrompt(item, options)); + } + prompts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KnowledgeBaseAnswerDialog(isContextOnly, prompts ?? 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(KnowledgeBaseAnswerDialog)} does not support writing '{options.Format}' format."); + } + } + + KnowledgeBaseAnswerDialog 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 DeserializeKnowledgeBaseAnswerDialog(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KnowledgeBaseAnswerDialog)} 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 KnowledgeBaseAnswerDialog FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKnowledgeBaseAnswerDialog(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.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.cs new file mode 100644 index 0000000000000..87ded881e8dc1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerDialog.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Dialog associated with Answer. + public partial class KnowledgeBaseAnswerDialog + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal KnowledgeBaseAnswerDialog() + { + Prompts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. + /// List of prompts associated with the answer. + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswerDialog(bool? isContextOnly, IReadOnlyList prompts, IDictionary serializedAdditionalRawData) + { + IsContextOnly = isContextOnly; + Prompts = prompts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// To mark if a prompt is relevant only with a previous question or not. If true, do not include this QnA as search result for queries without context; otherwise, if false, ignores context and includes this QnA in search result. + public bool? IsContextOnly { get; } + /// List of prompts associated with the answer. + public IReadOnlyList Prompts { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs new file mode 100644 index 0000000000000..e14d729b3cab6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.Serialization.cs @@ -0,0 +1,168 @@ +// 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.Conversations.Models +{ + public partial class KnowledgeBaseAnswerPrompt : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KnowledgeBaseAnswerPrompt)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayOrder)) + { + writer.WritePropertyName("displayOrder"u8); + writer.WriteNumberValue(DisplayOrder.Value); + } + if (Optional.IsDefined(QnaId)) + { + writer.WritePropertyName("qnaId"u8); + writer.WriteNumberValue(QnaId.Value); + } + if (Optional.IsDefined(DisplayText)) + { + writer.WritePropertyName("displayText"u8); + writer.WriteStringValue(DisplayText); + } + 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 + } + } + writer.WriteEndObject(); + } + + KnowledgeBaseAnswerPrompt 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(KnowledgeBaseAnswerPrompt)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKnowledgeBaseAnswerPrompt(document.RootElement, options); + } + + internal static KnowledgeBaseAnswerPrompt DeserializeKnowledgeBaseAnswerPrompt(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? displayOrder = default; + int? qnaId = default; + string displayText = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayOrder"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + displayOrder = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("qnaId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qnaId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("displayText"u8)) + { + displayText = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KnowledgeBaseAnswerPrompt(displayOrder, qnaId, displayText, 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(KnowledgeBaseAnswerPrompt)} does not support writing '{options.Format}' format."); + } + } + + KnowledgeBaseAnswerPrompt 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 DeserializeKnowledgeBaseAnswerPrompt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KnowledgeBaseAnswerPrompt)} 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 KnowledgeBaseAnswerPrompt FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKnowledgeBaseAnswerPrompt(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.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.cs new file mode 100644 index 0000000000000..ef24541b29017 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/KnowledgeBaseAnswerPrompt.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.Conversations.Models +{ + /// Prompt for an answer. + public partial class KnowledgeBaseAnswerPrompt + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal KnowledgeBaseAnswerPrompt() + { + } + + /// Initializes a new instance of . + /// Index of the prompt - used in ordering of the prompts. + /// QnA ID corresponding to the prompt. + /// Text displayed to represent a follow up question prompt. + /// Keeps track of any properties unknown to the library. + internal KnowledgeBaseAnswerPrompt(int? displayOrder, int? qnaId, string displayText, IDictionary serializedAdditionalRawData) + { + DisplayOrder = displayOrder; + QnaId = qnaId; + DisplayText = displayText; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Index of the prompt - used in ordering of the prompts. + public int? DisplayOrder { get; } + /// QnA ID corresponding to the prompt. + public int? QnaId { get; } + /// Text displayed to represent a follow up question prompt. + public string DisplayText { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.Serialization.cs new file mode 100644 index 0000000000000..624bae1869405 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class LengthResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LengthResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + LengthResolution 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(LengthResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLengthResolution(document.RootElement, options); + } + + internal static LengthResolution DeserializeLengthResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + LengthUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new LengthUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LengthResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LengthResolution)} does not support writing '{options.Format}' format."); + } + } + + LengthResolution 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 DeserializeLengthResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LengthResolution)} 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 LengthResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLengthResolution(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.Conversations/src/Generated/Models/LengthResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.cs new file mode 100644 index 0000000000000..e5b91b539109c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the length entity resolution model. + public partial class LengthResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The length Unit of measurement. + internal LengthResolution(double value, LengthUnit unit) + { + ResolutionKind = ResolutionKind.LengthResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The length Unit of measurement. + internal LengthResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, LengthUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal LengthResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The length Unit of measurement. + public LengthUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthUnit.cs new file mode 100644 index 0000000000000..d0815b8e3b473 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LengthUnit.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The length unit of measurement. + public readonly partial struct LengthUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LengthUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string KilometerValue = "Kilometer"; + private const string HectometerValue = "Hectometer"; + private const string DecameterValue = "Decameter"; + private const string MeterValue = "Meter"; + private const string DecimeterValue = "Decimeter"; + private const string CentimeterValue = "Centimeter"; + private const string MillimeterValue = "Millimeter"; + private const string MicrometerValue = "Micrometer"; + private const string NanometerValue = "Nanometer"; + private const string PicometerValue = "Picometer"; + private const string MileValue = "Mile"; + private const string YardValue = "Yard"; + private const string InchValue = "Inch"; + private const string FootValue = "Foot"; + private const string LightYearValue = "LightYear"; + private const string PointValue = "Pt"; + + /// Unspecified length unit. + public static LengthUnit Unspecified { get; } = new LengthUnit(UnspecifiedValue); + /// Kilometer length unit. + public static LengthUnit Kilometer { get; } = new LengthUnit(KilometerValue); + /// Hectometer length unit. + public static LengthUnit Hectometer { get; } = new LengthUnit(HectometerValue); + /// Decameter length unit. + public static LengthUnit Decameter { get; } = new LengthUnit(DecameterValue); + /// Meter length unit. + public static LengthUnit Meter { get; } = new LengthUnit(MeterValue); + /// Decimeter length unit. + public static LengthUnit Decimeter { get; } = new LengthUnit(DecimeterValue); + /// Centimeter length unit. + public static LengthUnit Centimeter { get; } = new LengthUnit(CentimeterValue); + /// Millimeter length unit. + public static LengthUnit Millimeter { get; } = new LengthUnit(MillimeterValue); + /// Micrometer length unit. + public static LengthUnit Micrometer { get; } = new LengthUnit(MicrometerValue); + /// Nanometer length unit. + public static LengthUnit Nanometer { get; } = new LengthUnit(NanometerValue); + /// Picometer length unit. + public static LengthUnit Picometer { get; } = new LengthUnit(PicometerValue); + /// Mile length unit. + public static LengthUnit Mile { get; } = new LengthUnit(MileValue); + /// Yard length unit. + public static LengthUnit Yard { get; } = new LengthUnit(YardValue); + /// Inch length unit. + public static LengthUnit Inch { get; } = new LengthUnit(InchValue); + /// Foot length unit. + public static LengthUnit Foot { get; } = new LengthUnit(FootValue); + /// Light year length unit. + public static LengthUnit LightYear { get; } = new LengthUnit(LightYearValue); + /// Point length unit. + public static LengthUnit Point { get; } = new LengthUnit(PointValue); + /// Determines if two values are the same. + public static bool operator ==(LengthUnit left, LengthUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LengthUnit left, LengthUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LengthUnit(string value) => new LengthUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LengthUnit other && Equals(other); + /// + public bool Equals(LengthUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.Serialization.cs new file mode 100644 index 0000000000000..1648ec7f70944 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.Serialization.cs @@ -0,0 +1,146 @@ +// 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.Conversations.Models +{ + public partial class ListKey : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListKey)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + writer.WritePropertyName("extraInformationKind"u8); + writer.WriteStringValue(ExtraInformationKind.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 + } + } + writer.WriteEndObject(); + } + + ListKey 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(ListKey)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListKey(document.RootElement, options); + } + + internal static ListKey DeserializeListKey(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + ExtraInformationKind extraInformationKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("extraInformationKind"u8)) + { + extraInformationKind = new ExtraInformationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ListKey(extraInformationKind, serializedAdditionalRawData, key); + } + + 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(ListKey)} does not support writing '{options.Format}' format."); + } + } + + ListKey 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 DeserializeListKey(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListKey)} 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 ListKey FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeListKey(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.Conversations/src/Generated/Models/ListKey.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.cs new file mode 100644 index 0000000000000..92244df5e7c99 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ListKey.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.Conversations.Models +{ + /// The list key extra data kind. + public partial class ListKey : ConversationEntityExtraInformation + { + /// Initializes a new instance of . + internal ListKey() + { + ExtraInformationKind = ExtraInformationKind.ListKey; + } + + /// Initializes a new instance of . + /// The extra information object kind. + /// Keeps track of any properties unknown to the library. + /// The canonical form of the extracted entity. + internal ListKey(ExtraInformationKind extraInformationKind, IDictionary serializedAdditionalRawData, string key) : base(extraInformationKind, serializedAdditionalRawData) + { + Key = key; + } + + /// The canonical form of the extracted entity. + public string Key { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LogicalOperationKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LogicalOperationKind.cs new file mode 100644 index 0000000000000..b7ff3df554034 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LogicalOperationKind.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.Conversations.Models +{ + /// Set to 'OR' or 'AND' for using corresponding logical operation. + internal readonly partial struct LogicalOperationKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LogicalOperationKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AndValue = "AND"; + private const string OrValue = "OR"; + + /// Logical AND. + public static LogicalOperationKind And { get; } = new LogicalOperationKind(AndValue); + /// Logical OR. + public static LogicalOperationKind Or { get; } = new LogicalOperationKind(OrValue); + /// Determines if two values are the same. + public static bool operator ==(LogicalOperationKind left, LogicalOperationKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LogicalOperationKind left, LogicalOperationKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LogicalOperationKind(string value) => new LogicalOperationKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LogicalOperationKind other && Equals(other); + /// + public bool Equals(LogicalOperationKind 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.Conversations/src/Generated/Models/LuisCallingConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisCallingConfig.Serialization.cs new file mode 100644 index 0000000000000..efb0fdaffe67a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisCallingConfig.Serialization.cs @@ -0,0 +1,220 @@ +// 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.Conversations.Models +{ + internal partial class LuisCallingConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LuisCallingConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Verbose)) + { + writer.WritePropertyName("verbose"u8); + writer.WriteBooleanValue(Verbose.Value); + } + if (Optional.IsDefined(Log)) + { + writer.WritePropertyName("log"u8); + writer.WriteBooleanValue(Log.Value); + } + if (Optional.IsDefined(ShowAllIntents)) + { + writer.WritePropertyName("show-all-intents"u8); + writer.WriteBooleanValue(ShowAllIntents.Value); + } + if (Optional.IsDefined(TimezoneOffset)) + { + writer.WritePropertyName("timezoneOffset"u8); + writer.WriteNumberValue(TimezoneOffset.Value); + } + if (Optional.IsDefined(SpellCheck)) + { + writer.WritePropertyName("spellCheck"u8); + writer.WriteBooleanValue(SpellCheck.Value); + } + if (Optional.IsDefined(BingSpellCheckSubscriptionKey)) + { + writer.WritePropertyName("bing-spell-check-subscription-key"u8); + writer.WriteStringValue(BingSpellCheckSubscriptionKey); + } + 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 + } + } + writer.WriteEndObject(); + } + + LuisCallingConfig 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(LuisCallingConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLuisCallingConfig(document.RootElement, options); + } + + internal static LuisCallingConfig DeserializeLuisCallingConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? verbose = default; + bool? log = default; + bool? showAllIntents = default; + int? timezoneOffset = default; + bool? spellCheck = default; + string bingSpellCheckSubscriptionKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verbose"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + verbose = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("log"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + log = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("show-all-intents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + showAllIntents = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("timezoneOffset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timezoneOffset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("spellCheck"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spellCheck = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("bing-spell-check-subscription-key"u8)) + { + bingSpellCheckSubscriptionKey = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LuisCallingConfig( + verbose, + log, + showAllIntents, + timezoneOffset, + spellCheck, + bingSpellCheckSubscriptionKey, + 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(LuisCallingConfig)} does not support writing '{options.Format}' format."); + } + } + + LuisCallingConfig 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 DeserializeLuisCallingConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LuisCallingConfig)} 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 LuisCallingConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLuisCallingConfig(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.Conversations/src/Generated/Models/LuisCallingConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisCallingConfig.cs new file mode 100644 index 0000000000000..0a83bf26368a7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisCallingConfig.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.Conversations.Models +{ + /// This customizes how the service calls LUIS Generally Available projects. + internal partial class LuisCallingConfig + { + /// + /// 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 LuisCallingConfig() + { + } + + /// Initializes a new instance of . + /// Enable verbose response. + /// Save log to add in training utterances later. + /// Set true to show all intents. + /// The timezone offset for the location of the request. + /// Enable spell checking. + /// The subscription key to use when enabling Bing spell check. + /// Keeps track of any properties unknown to the library. + internal LuisCallingConfig(bool? verbose, bool? log, bool? showAllIntents, int? timezoneOffset, bool? spellCheck, string bingSpellCheckSubscriptionKey, IDictionary serializedAdditionalRawData) + { + Verbose = verbose; + Log = log; + ShowAllIntents = showAllIntents; + TimezoneOffset = timezoneOffset; + SpellCheck = spellCheck; + BingSpellCheckSubscriptionKey = bingSpellCheckSubscriptionKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enable verbose response. + public bool? Verbose { get; set; } + /// Save log to add in training utterances later. + public bool? Log { get; set; } + /// Set true to show all intents. + public bool? ShowAllIntents { get; set; } + /// The timezone offset for the location of the request. + public int? TimezoneOffset { get; set; } + /// Enable spell checking. + public bool? SpellCheck { get; set; } + /// The subscription key to use when enabling Bing spell check. + public string BingSpellCheckSubscriptionKey { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.Serialization.cs new file mode 100644 index 0000000000000..804aada23a44a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.Serialization.cs @@ -0,0 +1,172 @@ +// 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.Conversations.Models +{ + internal partial class LuisConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LuisConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Query)) + { + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + } + if (Optional.IsDefined(CallingOptions)) + { + writer.WritePropertyName("callingOptions"u8); + writer.WriteObjectValue(CallingOptions, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + 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 + } + } + writer.WriteEndObject(); + } + + LuisConfig 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(LuisConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLuisConfig(document.RootElement, options); + } + + internal static LuisConfig DeserializeLuisConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string query = default; + LuisCallingConfig callingOptions = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (property.NameEquals("callingOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callingOptions = LuisCallingConfig.DeserializeLuisCallingConfig(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LuisConfig(targetProjectKind, apiVersion, serializedAdditionalRawData, query, callingOptions); + } + + 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(LuisConfig)} does not support writing '{options.Format}' format."); + } + } + + LuisConfig 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 DeserializeLuisConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LuisConfig)} 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 LuisConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLuisConfig(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.Conversations/src/Generated/Models/LuisConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.cs new file mode 100644 index 0000000000000..b9318e72b3831 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisConfig.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// This is a set of request parameters for LUIS Generally Available projects. + internal partial class LuisConfig : AnalysisConfig + { + /// Initializes a new instance of . + public LuisConfig() + { + TargetProjectKind = TargetProjectKind.Luis; + } + + /// Initializes a new instance of . + /// The type of a target service. + /// The API version to use when call a specific target service. + /// Keeps track of any properties unknown to the library. + /// The utterance to predict. + /// This customizes how the service calls LUIS Generally Available projects. + internal LuisConfig(TargetProjectKind targetProjectKind, string apiVersion, IDictionary serializedAdditionalRawData, string query, LuisCallingConfig callingOptions) : base(targetProjectKind, apiVersion, serializedAdditionalRawData) + { + Query = query; + CallingOptions = callingOptions; + } + + /// The utterance to predict. + public string Query { get; set; } + /// This customizes how the service calls LUIS Generally Available projects. + public LuisCallingConfig CallingOptions { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.Serialization.cs new file mode 100644 index 0000000000000..629b705877e20 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.Serialization.cs @@ -0,0 +1,121 @@ +// 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.Conversations.Models +{ + public partial class LuisResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LuisResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + + LuisResult 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(LuisResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLuisResult(document.RootElement, options); + } + + internal static LuisResult DeserializeLuisResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new LuisResult(additionalProperties); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LuisResult)} does not support writing '{options.Format}' format."); + } + } + + LuisResult 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 DeserializeLuisResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LuisResult)} 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 LuisResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLuisResult(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.Conversations/src/Generated/Models/LuisResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.cs new file mode 100644 index 0000000000000..26d1ecd6c20e5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisResult.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// It is the response from a LUIS Generally Available application. + public partial class LuisResult + { + /// Initializes a new instance of . + internal LuisResult() + { + AdditionalProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Additional Properties. + internal LuisResult(IReadOnlyDictionary additionalProperties) + { + AdditionalProperties = additionalProperties; + } + + /// + /// Additional Properties + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IReadOnlyDictionary AdditionalProperties { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.Serialization.cs new file mode 100644 index 0000000000000..145303e2c8535 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.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.Conversations.Models +{ + public partial class LuisTargetIntentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LuisTargetIntentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + LuisTargetIntentResult 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(LuisTargetIntentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLuisTargetIntentResult(document.RootElement, options); + } + + internal static LuisTargetIntentResult DeserializeLuisTargetIntentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LuisResult result = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = LuisResult.DeserializeLuisResult(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LuisTargetIntentResult(targetProjectKind, apiVersion, confidenceScore, serializedAdditionalRawData, result); + } + + 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(LuisTargetIntentResult)} does not support writing '{options.Format}' format."); + } + } + + LuisTargetIntentResult 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 DeserializeLuisTargetIntentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LuisTargetIntentResult)} 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 LuisTargetIntentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLuisTargetIntentResult(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.Conversations/src/Generated/Models/LuisTargetIntentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.cs new file mode 100644 index 0000000000000..09702741e6841 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/LuisTargetIntentResult.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// It is a wrap up of LUIS Generally Available response. + public partial class LuisTargetIntentResult : TargetIntentResult + { + /// Initializes a new instance of . + /// The prediction score and it ranges from 0.0 to 1.0. + internal LuisTargetIntentResult(double confidence) : base(confidence) + { + TargetProjectKind = TargetProjectKind.Luis; + } + + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + /// The actual response from a LUIS Generally Available application. + internal LuisTargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, IDictionary serializedAdditionalRawData, LuisResult result) : base(targetProjectKind, apiVersion, confidence, serializedAdditionalRawData) + { + Result = result; + } + + /// Initializes a new instance of for deserialization. + internal LuisTargetIntentResult() + { + } + + /// The actual response from a LUIS Generally Available application. + public LuisResult Result { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.Serialization.cs new file mode 100644 index 0000000000000..f2cd27f93c63a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class MetadataFilter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetadataFilter)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartArray(); + foreach (var item in Metadata) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LogicalOperation)) + { + writer.WritePropertyName("logicalOperation"u8); + writer.WriteStringValue(LogicalOperation.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + MetadataFilter 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(MetadataFilter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataFilter(document.RootElement, options); + } + + internal static MetadataFilter DeserializeMetadataFilter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList metadata = default; + LogicalOperationKind? logicalOperation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetadataRecord.DeserializeMetadataRecord(item, options)); + } + metadata = array; + continue; + } + if (property.NameEquals("logicalOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logicalOperation = new LogicalOperationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetadataFilter(metadata ?? new ChangeTrackingList(), logicalOperation, 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(MetadataFilter)} does not support writing '{options.Format}' format."); + } + } + + MetadataFilter 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 DeserializeMetadataFilter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetadataFilter)} 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 MetadataFilter FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMetadataFilter(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.Conversations/src/Generated/Models/MetadataFilter.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.cs new file mode 100644 index 0000000000000..a988daa9b05ef --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataFilter.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Find QnAs that are associated with the given list of metadata. + internal partial class MetadataFilter + { + /// + /// 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 MetadataFilter() + { + Metadata = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of metadata. + /// Operation used to join metadata filters. + /// Keeps track of any properties unknown to the library. + internal MetadataFilter(IList metadata, LogicalOperationKind? logicalOperation, IDictionary serializedAdditionalRawData) + { + Metadata = metadata; + LogicalOperation = logicalOperation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of metadata. + public IList Metadata { get; } + /// Operation used to join metadata filters. + public LogicalOperationKind? LogicalOperation { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.Serialization.cs new file mode 100644 index 0000000000000..1bc738a6a7ba3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.Serialization.cs @@ -0,0 +1,143 @@ +// 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.Conversations.Models +{ + internal partial class MetadataRecord : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MetadataRecord)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(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 + } + } + writer.WriteEndObject(); + } + + MetadataRecord 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(MetadataRecord)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMetadataRecord(document.RootElement, options); + } + + internal static MetadataRecord DeserializeMetadataRecord(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MetadataRecord(key, value, 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(MetadataRecord)} does not support writing '{options.Format}' format."); + } + } + + MetadataRecord 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 DeserializeMetadataRecord(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MetadataRecord)} 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 MetadataRecord FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMetadataRecord(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.Conversations/src/Generated/Models/MetadataRecord.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.cs new file mode 100644 index 0000000000000..489494cff58cf --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MetadataRecord.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.Conversations.Models +{ + /// Object to provide the key value pair for each metadata. + internal partial class MetadataRecord + { + /// + /// 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 . + /// Metadata Key from Metadata dictionary used in the QnA. + /// Metadata Value from Metadata dictionary used in the QnA. + /// or is null. + public MetadataRecord(string key, string value) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + Key = key; + Value = value; + } + + /// Initializes a new instance of . + /// Metadata Key from Metadata dictionary used in the QnA. + /// Metadata Value from Metadata dictionary used in the QnA. + /// Keeps track of any properties unknown to the library. + internal MetadataRecord(string key, string value, IDictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MetadataRecord() + { + } + + /// Metadata Key from Metadata dictionary used in the QnA. + public string Key { get; } + /// Metadata Value from Metadata dictionary used in the QnA. + public string Value { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.Serialization.cs new file mode 100644 index 0000000000000..b1128b207c514 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.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.Conversations.Models +{ + public partial class MultiLanguageConversationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageConversationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("conversations"u8); + writer.WriteStartArray(); + foreach (var item in Conversations) + { + 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 + } + } + writer.WriteEndObject(); + } + + MultiLanguageConversationInput 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(MultiLanguageConversationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultiLanguageConversationInput(document.RootElement, options); + } + + internal static MultiLanguageConversationInput DeserializeMultiLanguageConversationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList conversations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationInput.DeserializeConversationInput(item, options)); + } + conversations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MultiLanguageConversationInput(conversations, 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(MultiLanguageConversationInput)} does not support writing '{options.Format}' format."); + } + } + + MultiLanguageConversationInput 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 DeserializeMultiLanguageConversationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultiLanguageConversationInput)} 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 MultiLanguageConversationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMultiLanguageConversationInput(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.Conversations/src/Generated/Models/MultiLanguageConversationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.cs new file mode 100644 index 0000000000000..dabf16553a41d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/MultiLanguageConversationInput.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Multi Language Conversation Analysis Input. + public partial class MultiLanguageConversationInput + { + /// + /// 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 . + /// + /// Array of conversation items + /// 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 . + /// + /// is null. + public MultiLanguageConversationInput(IEnumerable conversations) + { + Argument.AssertNotNull(conversations, nameof(conversations)); + + Conversations = conversations.ToList(); + } + + /// Initializes a new instance of . + /// + /// Array of conversation items + /// 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 MultiLanguageConversationInput(IList conversations, IDictionary serializedAdditionalRawData) + { + Conversations = conversations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultiLanguageConversationInput() + { + } + + /// + /// Array of conversation items + /// 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 Conversations { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs new file mode 100644 index 0000000000000..72976ce646bf5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.Serialization.cs @@ -0,0 +1,185 @@ +// 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.Conversations.Models +{ + public partial class NamedEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntity)} does not support writing '{format}' format."); + } + + writer.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); + 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 + } + } + writer.WriteEndObject(); + } + + NamedEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamedEntity(document.RootElement, options); + } + + internal static NamedEntity DeserializeNamedEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + string category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamedEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NamedEntity)} does not support writing '{options.Format}' format."); + } + } + + NamedEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNamedEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamedEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NamedEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNamedEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs new file mode 100644 index 0000000000000..f8079487a0a59 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NamedEntity.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Text that has been categorized into pre-defined classes or types such as: person, location, event, product, and organization. + public partial class NamedEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// or is null. + internal NamedEntity(string text, string category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(category, nameof(category)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Keeps track of any properties unknown to the library. + internal NamedEntity(string text, string category, string subcategory, int offset, int length, double confidenceScore, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NamedEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Entity type. + public string Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.Serialization.cs new file mode 100644 index 0000000000000..ebfbd8552207f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.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.Conversations.Models +{ + public partial class NoneLinkedTargetIntentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NoneLinkedTargetIntentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + NoneLinkedTargetIntentResult 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(NoneLinkedTargetIntentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNoneLinkedTargetIntentResult(document.RootElement, options); + } + + internal static NoneLinkedTargetIntentResult DeserializeNoneLinkedTargetIntentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationResult result = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = ConversationResult.DeserializeConversationResult(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NoneLinkedTargetIntentResult(targetProjectKind, apiVersion, confidenceScore, serializedAdditionalRawData, result); + } + + 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(NoneLinkedTargetIntentResult)} does not support writing '{options.Format}' format."); + } + } + + NoneLinkedTargetIntentResult 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 DeserializeNoneLinkedTargetIntentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NoneLinkedTargetIntentResult)} 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 NoneLinkedTargetIntentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNoneLinkedTargetIntentResult(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.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.cs new file mode 100644 index 0000000000000..401e3b1193b0d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NoneLinkedTargetIntentResult.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A wrap up of non-linked intent response. + public partial class NoneLinkedTargetIntentResult : TargetIntentResult + { + /// Initializes a new instance of . + /// The prediction score and it ranges from 0.0 to 1.0. + internal NoneLinkedTargetIntentResult(double confidence) : base(confidence) + { + TargetProjectKind = TargetProjectKind.NonLinked; + } + + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + /// The actual response from a Conversation project. + internal NoneLinkedTargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, IDictionary serializedAdditionalRawData, ConversationResult result) : base(targetProjectKind, apiVersion, confidence, serializedAdditionalRawData) + { + Result = result; + } + + /// Initializes a new instance of for deserialization. + internal NoneLinkedTargetIntentResult() + { + } + + /// The actual response from a Conversation project. + public ConversationResult Result { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberKind.cs new file mode 100644 index 0000000000000..a7a71e8d68ffe --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberKind.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The type of the extracted number entity. + public readonly partial struct NumberKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NumberKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IntegerValue = "Integer"; + private const string DecimalValue = "Decimal"; + private const string PowerValue = "Power"; + private const string FractionValue = "Fraction"; + private const string PercentValue = "Percent"; + private const string UnspecifiedValue = "Unspecified"; + + /// Integer number. + public static NumberKind Integer { get; } = new NumberKind(IntegerValue); + /// Decimal number. + public static NumberKind Decimal { get; } = new NumberKind(DecimalValue); + /// Power number. + public static NumberKind Power { get; } = new NumberKind(PowerValue); + /// Fraction number. + public static NumberKind Fraction { get; } = new NumberKind(FractionValue); + /// Percent number. + public static NumberKind Percent { get; } = new NumberKind(PercentValue); + /// Unspecified number kind. + public static NumberKind Unspecified { get; } = new NumberKind(UnspecifiedValue); + /// Determines if two values are the same. + public static bool operator ==(NumberKind left, NumberKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NumberKind left, NumberKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NumberKind(string value) => new NumberKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NumberKind other && Equals(other); + /// + public bool Equals(NumberKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.Serialization.cs new file mode 100644 index 0000000000000..7911e9b3113d1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class NumberResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumberResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("numberKind"u8); + writer.WriteStringValue(NumberKind.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + NumberResolution 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(NumberResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNumberResolution(document.RootElement, options); + } + + internal static NumberResolution DeserializeNumberResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NumberKind numberKind = default; + double value = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("numberKind"u8)) + { + numberKind = new NumberKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NumberResolution(resolutionKind, serializedAdditionalRawData, numberKind, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NumberResolution)} does not support writing '{options.Format}' format."); + } + } + + NumberResolution 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 DeserializeNumberResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NumberResolution)} 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 NumberResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumberResolution(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.Conversations/src/Generated/Models/NumberResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.cs new file mode 100644 index 0000000000000..76550a944edd8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumberResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A resolution for numeric entity instances. + public partial class NumberResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The type of the extracted number entity. + /// A numeric representation of what the extracted text denotes. + internal NumberResolution(NumberKind numberKind, double value) + { + ResolutionKind = ResolutionKind.NumberResolution; + NumberKind = numberKind; + Value = value; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The type of the extracted number entity. + /// A numeric representation of what the extracted text denotes. + internal NumberResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, NumberKind numberKind, double value) : base(resolutionKind, serializedAdditionalRawData) + { + NumberKind = numberKind; + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal NumberResolution() + { + } + + /// The type of the extracted number entity. + public NumberKind NumberKind { get; } + /// A numeric representation of what the extracted text denotes. + public double Value { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.Serialization.cs new file mode 100644 index 0000000000000..84c20a2d6dd65 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.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.Conversations.Models +{ + public partial class NumericRangeResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumericRangeResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("rangeKind"u8); + writer.WriteStringValue(RangeKind.ToString()); + writer.WritePropertyName("minimum"u8); + writer.WriteNumberValue(Minimum); + writer.WritePropertyName("maximum"u8); + writer.WriteNumberValue(Maximum); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + NumericRangeResolution 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(NumericRangeResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNumericRangeResolution(document.RootElement, options); + } + + internal static NumericRangeResolution DeserializeNumericRangeResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RangeKind rangeKind = default; + double minimum = default; + double maximum = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rangeKind"u8)) + { + rangeKind = new RangeKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("minimum"u8)) + { + minimum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("maximum"u8)) + { + maximum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NumericRangeResolution(resolutionKind, serializedAdditionalRawData, rangeKind, minimum, maximum); + } + + 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(NumericRangeResolution)} does not support writing '{options.Format}' format."); + } + } + + NumericRangeResolution 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 DeserializeNumericRangeResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NumericRangeResolution)} 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 NumericRangeResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumericRangeResolution(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.Conversations/src/Generated/Models/NumericRangeResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.cs new file mode 100644 index 0000000000000..41ae4cf17a9e6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/NumericRangeResolution.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// represents the resolution of numeric intervals. + public partial class NumericRangeResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The kind of range that the resolution object represents. + /// The beginning value of the interval. + /// The ending value of the interval. + internal NumericRangeResolution(RangeKind rangeKind, double minimum, double maximum) + { + ResolutionKind = ResolutionKind.NumericRangeResolution; + RangeKind = rangeKind; + Minimum = minimum; + Maximum = maximum; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The kind of range that the resolution object represents. + /// The beginning value of the interval. + /// The ending value of the interval. + internal NumericRangeResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, RangeKind rangeKind, double minimum, double maximum) : base(resolutionKind, serializedAdditionalRawData) + { + RangeKind = rangeKind; + Minimum = minimum; + Maximum = maximum; + } + + /// Initializes a new instance of for deserialization. + internal NumericRangeResolution() + { + } + + /// The kind of range that the resolution object represents. + public RangeKind RangeKind { get; } + /// The beginning value of the interval. + public double Minimum { get; } + /// The ending value of the interval. + public double Maximum { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.Serialization.cs new file mode 100644 index 0000000000000..8bbea7966e933 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class OrchestrationPrediction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrchestrationPrediction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("intents"u8); + writer.WriteStartObject(); + foreach (var item in Intents) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + writer.WritePropertyName("projectKind"u8); + writer.WriteStringValue(ProjectKind.ToString()); + if (Optional.IsDefined(TopIntent)) + { + writer.WritePropertyName("topIntent"u8); + writer.WriteStringValue(TopIntent); + } + 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 + } + } + writer.WriteEndObject(); + } + + OrchestrationPrediction 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(OrchestrationPrediction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrchestrationPrediction(document.RootElement, options); + } + + internal static OrchestrationPrediction DeserializeOrchestrationPrediction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary intents = default; + ProjectKind projectKind = default; + string topIntent = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("intents"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, TargetIntentResult.DeserializeTargetIntentResult(property0.Value, options)); + } + intents = dictionary; + continue; + } + if (property.NameEquals("projectKind"u8)) + { + projectKind = new ProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("topIntent"u8)) + { + topIntent = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OrchestrationPrediction(projectKind, topIntent, serializedAdditionalRawData, intents); + } + + 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(OrchestrationPrediction)} does not support writing '{options.Format}' format."); + } + } + + OrchestrationPrediction 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 DeserializeOrchestrationPrediction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrchestrationPrediction)} 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 OrchestrationPrediction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOrchestrationPrediction(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.Conversations/src/Generated/Models/OrchestrationPrediction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.cs new file mode 100644 index 0000000000000..da125032755a4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrchestrationPrediction.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// This represents the prediction result of an Orchestration project. + public partial class OrchestrationPrediction : PredictionBase + { + /// Initializes a new instance of . + /// + /// A dictionary that contains all intents. A key is an intent name and a value is its confidence score and target type. The top intent's value also contains the actual response from the target project. + /// 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 . + /// + /// is null. + internal OrchestrationPrediction(IReadOnlyDictionary intents) + { + Argument.AssertNotNull(intents, nameof(intents)); + + ProjectKind = ProjectKind.Orchestration; + Intents = intents; + } + + /// Initializes a new instance of . + /// The type of the project. + /// The intent with the highest score. + /// Keeps track of any properties unknown to the library. + /// + /// A dictionary that contains all intents. A key is an intent name and a value is its confidence score and target type. The top intent's value also contains the actual response from the target project. + /// 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 OrchestrationPrediction(ProjectKind projectKind, string topIntent, IDictionary serializedAdditionalRawData, IReadOnlyDictionary intents) : base(projectKind, topIntent, serializedAdditionalRawData) + { + Intents = intents; + } + + /// Initializes a new instance of for deserialization. + internal OrchestrationPrediction() + { + } + + /// + /// A dictionary that contains all intents. A key is an intent name and a value is its confidence score and target type. The top intent's value also contains the actual response from the target project. + /// 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 IReadOnlyDictionary Intents { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.Serialization.cs new file mode 100644 index 0000000000000..b34092a88c2f1 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.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.Conversations.Models +{ + public partial class OrdinalResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrdinalResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("offset"u8); + writer.WriteStringValue(Offset); + writer.WritePropertyName("relativeTo"u8); + writer.WriteStringValue(RelativeTo.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + OrdinalResolution 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(OrdinalResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrdinalResolution(document.RootElement, options); + } + + internal static OrdinalResolution DeserializeOrdinalResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string offset = default; + RelativeTo relativeTo = default; + string value = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetString(); + continue; + } + if (property.NameEquals("relativeTo"u8)) + { + relativeTo = new RelativeTo(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OrdinalResolution(resolutionKind, serializedAdditionalRawData, offset, relativeTo, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OrdinalResolution)} does not support writing '{options.Format}' format."); + } + } + + OrdinalResolution 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 DeserializeOrdinalResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrdinalResolution)} 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 OrdinalResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOrdinalResolution(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.Conversations/src/Generated/Models/OrdinalResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.cs new file mode 100644 index 0000000000000..cbceb0af8d380 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/OrdinalResolution.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// A resolution for ordinal numbers entity instances. + public partial class OrdinalResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + /// or is null. + internal OrdinalResolution(string offset, RelativeTo relativeTo, string value) + { + Argument.AssertNotNull(offset, nameof(offset)); + Argument.AssertNotNull(value, nameof(value)); + + ResolutionKind = ResolutionKind.OrdinalResolution; + Offset = offset; + RelativeTo = relativeTo; + Value = value; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + internal OrdinalResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, string offset, RelativeTo relativeTo, string value) : base(resolutionKind, serializedAdditionalRawData) + { + Offset = offset; + RelativeTo = relativeTo; + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal OrdinalResolution() + { + } + + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + public string Offset { get; } + /// The reference point that the ordinal number denotes. + public RelativeTo RelativeTo { get; } + /// A simple arithmetic expression that the ordinal denotes. + public string Value { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ParticipantRole.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ParticipantRole.cs new file mode 100644 index 0000000000000..59100d789a596 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ParticipantRole.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.Conversations.Models +{ + /// Role of the participant. + public readonly partial struct ParticipantRole : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ParticipantRole(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CustomerValue = "customer"; + private const string AgentValue = "agent"; + private const string GenericValue = "generic"; + + /// The participant is a customer. + public static ParticipantRole Customer { get; } = new ParticipantRole(CustomerValue); + /// The participant is an agent. + public static ParticipantRole Agent { get; } = new ParticipantRole(AgentValue); + /// The is a generic participant. + public static ParticipantRole Generic { get; } = new ParticipantRole(GenericValue); + /// Determines if two values are the same. + public static bool operator ==(ParticipantRole left, ParticipantRole right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ParticipantRole left, ParticipantRole right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ParticipantRole(string value) => new ParticipantRole(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ParticipantRole other && Equals(other); + /// + public bool Equals(ParticipantRole 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.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.Serialization.cs new file mode 100644 index 0000000000000..544df72558637 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.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.Conversations.Models +{ + public partial class PiiOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + PiiOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiOperationAction(document.RootElement, options); + } + + internal static PiiOperationAction DeserializePiiOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationPiiActionContent parameters = default; + string taskName = default; + AnalyzeConversationOperationActionKind 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 = ConversationPiiActionContent.DeserializeConversationPiiActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support writing '{options.Format}' format."); + } + } + + PiiOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PiiOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs new file mode 100644 index 0000000000000..60d95bc1ccb1c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PiiOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Task definition for a PII redaction in conversations. + public partial class PiiOperationAction : AnalyzeConversationOperationAction + { + /// Initializes a new instance of . + public PiiOperationAction() + { + Kind = AnalyzeConversationOperationActionKind.ConversationalPIITask; + } + + /// Initializes a new instance of . + /// task name. + /// Enumeration of supported analysis tasks on a collection of conversations. + /// Keeps track of any properties unknown to the library. + /// parameters. + internal PiiOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, ConversationPiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// parameters. + public ConversationPiiActionContent ActionContent { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.Serialization.cs new file mode 100644 index 0000000000000..ddd014e0c293f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownPredictionBase))] + public partial class PredictionBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PredictionBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("projectKind"u8); + writer.WriteStringValue(ProjectKind.ToString()); + if (Optional.IsDefined(TopIntent)) + { + writer.WritePropertyName("topIntent"u8); + writer.WriteStringValue(TopIntent); + } + 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 + } + } + writer.WriteEndObject(); + } + + PredictionBase 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(PredictionBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePredictionBase(document.RootElement, options); + } + + internal static PredictionBase DeserializePredictionBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("projectKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Conversation": return ConversationPrediction.DeserializeConversationPrediction(element, options); + case "Orchestration": return OrchestrationPrediction.DeserializeOrchestrationPrediction(element, options); + } + } + return UnknownPredictionBase.DeserializeUnknownPredictionBase(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(PredictionBase)} does not support writing '{options.Format}' format."); + } + } + + PredictionBase 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 DeserializePredictionBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PredictionBase)} 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 PredictionBase FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePredictionBase(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.Conversations/src/Generated/Models/PredictionBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.cs new file mode 100644 index 0000000000000..0a5bc43b5321f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/PredictionBase.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.Conversations.Models +{ + /// + /// This is the base class of prediction + /// 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 PredictionBase + { + /// + /// 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 PredictionBase() + { + } + + /// Initializes a new instance of . + /// The type of the project. + /// The intent with the highest score. + /// Keeps track of any properties unknown to the library. + internal PredictionBase(ProjectKind projectKind, string topIntent, IDictionary serializedAdditionalRawData) + { + ProjectKind = projectKind; + TopIntent = topIntent; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of the project. + internal ProjectKind ProjectKind { get; set; } + /// The intent with the highest score. + public string TopIntent { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.cs new file mode 100644 index 0000000000000..ad161c133f63e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ProjectKind.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.Conversations.Models +{ + /// The type of the project. + internal readonly partial struct ProjectKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProjectKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConversationValue = "Conversation"; + private const string OrchestrationValue = "Orchestration"; + + /// Conversation type. + public static ProjectKind Conversation { get; } = new ProjectKind(ConversationValue); + /// Orchestration type. + public static ProjectKind Orchestration { get; } = new ProjectKind(OrchestrationValue); + /// Determines if two values are the same. + public static bool operator ==(ProjectKind left, ProjectKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProjectKind left, ProjectKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ProjectKind(string value) => new ProjectKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProjectKind other && Equals(other); + /// + public bool Equals(ProjectKind 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.Conversations/src/Generated/Models/QueryFilters.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QueryFilters.Serialization.cs new file mode 100644 index 0000000000000..475a05b56c32d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QueryFilters.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.Conversations.Models +{ + internal partial class QueryFilters : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QueryFilters)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(MetadataFilter)) + { + writer.WritePropertyName("metadataFilter"u8); + writer.WriteObjectValue(MetadataFilter, options); + } + if (Optional.IsCollectionDefined(SourceFilter)) + { + writer.WritePropertyName("sourceFilter"u8); + writer.WriteStartArray(); + foreach (var item in SourceFilter) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LogicalOperation)) + { + writer.WritePropertyName("logicalOperation"u8); + writer.WriteStringValue(LogicalOperation.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + QueryFilters 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(QueryFilters)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQueryFilters(document.RootElement, options); + } + + internal static QueryFilters DeserializeQueryFilters(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MetadataFilter metadataFilter = default; + IList sourceFilter = default; + LogicalOperationKind? logicalOperation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadataFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadataFilter = MetadataFilter.DeserializeMetadataFilter(property.Value, options); + continue; + } + if (property.NameEquals("sourceFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + sourceFilter = array; + continue; + } + if (property.NameEquals("logicalOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logicalOperation = new LogicalOperationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QueryFilters(metadataFilter, sourceFilter ?? new ChangeTrackingList(), logicalOperation, 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(QueryFilters)} does not support writing '{options.Format}' format."); + } + } + + QueryFilters 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 DeserializeQueryFilters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QueryFilters)} 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 QueryFilters FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueryFilters(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.Conversations/src/Generated/Models/QueryFilters.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QueryFilters.cs new file mode 100644 index 0000000000000..3cc0b97771d3a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QueryFilters.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// filters over knowledge base. + internal partial class QueryFilters + { + /// + /// 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 QueryFilters() + { + SourceFilter = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// filters over knowledge base. + /// filters over knowledge base. + /// Logical operation used to join metadata filter with source filter. + /// Keeps track of any properties unknown to the library. + internal QueryFilters(MetadataFilter metadataFilter, IList sourceFilter, LogicalOperationKind? logicalOperation, IDictionary serializedAdditionalRawData) + { + MetadataFilter = metadataFilter; + SourceFilter = sourceFilter; + LogicalOperation = logicalOperation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// filters over knowledge base. + public MetadataFilter MetadataFilter { get; set; } + /// filters over knowledge base. + public IList SourceFilter { get; } + /// Logical operation used to join metadata filter with source filter. + public LogicalOperationKind? LogicalOperation { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.Serialization.cs new file mode 100644 index 0000000000000..e474470f883a9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.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.Conversations.Models +{ + internal partial class QuestionAnsweringConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(CallingOptions)) + { + writer.WritePropertyName("callingOptions"u8); + writer.WriteObjectValue(CallingOptions, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + 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 + } + } + writer.WriteEndObject(); + } + + QuestionAnsweringConfig 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(QuestionAnsweringConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnsweringConfig(document.RootElement, options); + } + + internal static QuestionAnsweringConfig DeserializeQuestionAnsweringConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + QuestionAnswersConfig callingOptions = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("callingOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callingOptions = QuestionAnswersConfig.DeserializeQuestionAnswersConfig(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuestionAnsweringConfig(targetProjectKind, apiVersion, serializedAdditionalRawData, callingOptions); + } + + 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(QuestionAnsweringConfig)} does not support writing '{options.Format}' format."); + } + } + + QuestionAnsweringConfig 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 DeserializeQuestionAnsweringConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnsweringConfig)} 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 QuestionAnsweringConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQuestionAnsweringConfig(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.Conversations/src/Generated/Models/QuestionAnsweringConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.cs new file mode 100644 index 0000000000000..ebf365cf241e0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringConfig.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.Conversations.Models +{ + /// This is a set of request parameters for Question Answering knowledge bases. + internal partial class QuestionAnsweringConfig : AnalysisConfig + { + /// Initializes a new instance of . + public QuestionAnsweringConfig() + { + TargetProjectKind = TargetProjectKind.QuestionAnswering; + } + + /// Initializes a new instance of . + /// The type of a target service. + /// The API version to use when call a specific target service. + /// Keeps track of any properties unknown to the library. + /// The options sent to a Question Answering KB. + internal QuestionAnsweringConfig(TargetProjectKind targetProjectKind, string apiVersion, IDictionary serializedAdditionalRawData, QuestionAnswersConfig callingOptions) : base(targetProjectKind, apiVersion, serializedAdditionalRawData) + { + CallingOptions = callingOptions; + } + + /// The options sent to a Question Answering KB. + public QuestionAnswersConfig CallingOptions { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.Serialization.cs new file mode 100644 index 0000000000000..6ebed6e2fd19e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.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.Conversations.Models +{ + public partial class QuestionAnsweringTargetIntentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnsweringTargetIntentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + QuestionAnsweringTargetIntentResult 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(QuestionAnsweringTargetIntentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnsweringTargetIntentResult(document.RootElement, options); + } + + internal static QuestionAnsweringTargetIntentResult DeserializeQuestionAnsweringTargetIntentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnswersResult result = default; + TargetProjectKind targetProjectKind = default; + string apiVersion = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = AnswersResult.DeserializeAnswersResult(property.Value, options); + continue; + } + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuestionAnsweringTargetIntentResult(targetProjectKind, apiVersion, confidenceScore, serializedAdditionalRawData, result); + } + + 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(QuestionAnsweringTargetIntentResult)} does not support writing '{options.Format}' format."); + } + } + + QuestionAnsweringTargetIntentResult 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 DeserializeQuestionAnsweringTargetIntentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnsweringTargetIntentResult)} 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 QuestionAnsweringTargetIntentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQuestionAnsweringTargetIntentResult(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.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.cs new file mode 100644 index 0000000000000..c6bfb6680f618 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnsweringTargetIntentResult.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// It is a wrap up a Question Answering KB response. + public partial class QuestionAnsweringTargetIntentResult : TargetIntentResult + { + /// Initializes a new instance of . + /// The prediction score and it ranges from 0.0 to 1.0. + internal QuestionAnsweringTargetIntentResult(double confidence) : base(confidence) + { + TargetProjectKind = TargetProjectKind.QuestionAnswering; + } + + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + /// The generated answer by a Question Answering KB. + internal QuestionAnsweringTargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, IDictionary serializedAdditionalRawData, AnswersResult result) : base(targetProjectKind, apiVersion, confidence, serializedAdditionalRawData) + { + Result = result; + } + + /// Initializes a new instance of for deserialization. + internal QuestionAnsweringTargetIntentResult() + { + } + + /// The generated answer by a Question Answering KB. + public AnswersResult Result { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.Serialization.cs new file mode 100644 index 0000000000000..668e40570df4c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.Serialization.cs @@ -0,0 +1,280 @@ +// 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.Conversations.Models +{ + internal partial class QuestionAnswersConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QuestionAnswersConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(QnaId)) + { + writer.WritePropertyName("qnaId"u8); + writer.WriteNumberValue(QnaId.Value); + } + if (Optional.IsDefined(Question)) + { + writer.WritePropertyName("question"u8); + writer.WriteStringValue(Question); + } + if (Optional.IsDefined(Top)) + { + writer.WritePropertyName("top"u8); + writer.WriteNumberValue(Top.Value); + } + if (Optional.IsDefined(UserId)) + { + writer.WritePropertyName("userId"u8); + writer.WriteStringValue(UserId); + } + if (Optional.IsDefined(ConfidenceThreshold)) + { + writer.WritePropertyName("confidenceScoreThreshold"u8); + writer.WriteNumberValue(ConfidenceThreshold.Value); + } + if (Optional.IsDefined(AnswerContext)) + { + writer.WritePropertyName("context"u8); + writer.WriteObjectValue(AnswerContext, options); + } + if (Optional.IsDefined(RankerKind)) + { + writer.WritePropertyName("rankerType"u8); + writer.WriteStringValue(RankerKind.Value.ToString()); + } + if (Optional.IsDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteObjectValue(Filters, options); + } + if (Optional.IsDefined(ShortAnswerOptions)) + { + writer.WritePropertyName("answerSpanRequest"u8); + writer.WriteObjectValue(ShortAnswerOptions, options); + } + if (Optional.IsDefined(IncludeUnstructuredSources)) + { + writer.WritePropertyName("includeUnstructuredSources"u8); + writer.WriteBooleanValue(IncludeUnstructuredSources.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 + } + } + writer.WriteEndObject(); + } + + QuestionAnswersConfig 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(QuestionAnswersConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuestionAnswersConfig(document.RootElement, options); + } + + internal static QuestionAnswersConfig DeserializeQuestionAnswersConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? qnaId = default; + string question = default; + int? top = default; + string userId = default; + double? confidenceScoreThreshold = default; + KnowledgeBaseAnswerContext context = default; + RankerKind? rankerType = default; + QueryFilters filters = default; + ShortAnswerConfig answerSpanRequest = default; + bool? includeUnstructuredSources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("qnaId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + qnaId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("question"u8)) + { + question = property.Value.GetString(); + continue; + } + if (property.NameEquals("top"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + top = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("userId"u8)) + { + userId = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScoreThreshold"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScoreThreshold = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("context"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + context = KnowledgeBaseAnswerContext.DeserializeKnowledgeBaseAnswerContext(property.Value, options); + continue; + } + if (property.NameEquals("rankerType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rankerType = new RankerKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("filters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filters = QueryFilters.DeserializeQueryFilters(property.Value, options); + continue; + } + if (property.NameEquals("answerSpanRequest"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + answerSpanRequest = ShortAnswerConfig.DeserializeShortAnswerConfig(property.Value, options); + continue; + } + if (property.NameEquals("includeUnstructuredSources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + includeUnstructuredSources = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuestionAnswersConfig( + qnaId, + question, + top, + userId, + confidenceScoreThreshold, + context, + rankerType, + filters, + answerSpanRequest, + includeUnstructuredSources, + 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(QuestionAnswersConfig)} does not support writing '{options.Format}' format."); + } + } + + QuestionAnswersConfig 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 DeserializeQuestionAnswersConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuestionAnswersConfig)} 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 QuestionAnswersConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQuestionAnswersConfig(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.Conversations/src/Generated/Models/QuestionAnswersConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.cs new file mode 100644 index 0000000000000..c3c0043703d56 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/QuestionAnswersConfig.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Parameters to query a knowledge base. + internal partial class QuestionAnswersConfig + { + /// + /// 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 QuestionAnswersConfig() + { + } + + /// Initializes a new instance of . + /// Exact QnA ID to fetch from the knowledge base, this field takes priority over question. + /// User question to query against the knowledge base. + /// Max number of answers to be returned for the question. + /// Unique identifier for the user. + /// Minimum threshold score for answers, value ranges from 0 to 1. + /// Context object with previous QnA's information. + /// Type of ranker to be used. + /// Filter QnAs based on given metadata list and knowledge base sources. + /// To configure Answer span prediction feature. + /// (Optional) Flag to enable Query over Unstructured Sources. + /// Keeps track of any properties unknown to the library. + internal QuestionAnswersConfig(int? qnaId, string question, int? top, string userId, double? confidenceThreshold, KnowledgeBaseAnswerContext answerContext, RankerKind? rankerKind, QueryFilters filters, ShortAnswerConfig shortAnswerOptions, bool? includeUnstructuredSources, IDictionary serializedAdditionalRawData) + { + QnaId = qnaId; + Question = question; + Top = top; + UserId = userId; + ConfidenceThreshold = confidenceThreshold; + AnswerContext = answerContext; + RankerKind = rankerKind; + Filters = filters; + ShortAnswerOptions = shortAnswerOptions; + IncludeUnstructuredSources = includeUnstructuredSources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Exact QnA ID to fetch from the knowledge base, this field takes priority over question. + public int? QnaId { get; set; } + /// User question to query against the knowledge base. + public string Question { get; set; } + /// Max number of answers to be returned for the question. + public int? Top { get; set; } + /// Unique identifier for the user. + public string UserId { get; set; } + /// Minimum threshold score for answers, value ranges from 0 to 1. + public double? ConfidenceThreshold { get; set; } + /// Context object with previous QnA's information. + public KnowledgeBaseAnswerContext AnswerContext { get; set; } + /// Type of ranker to be used. + public RankerKind? RankerKind { get; set; } + /// Filter QnAs based on given metadata list and knowledge base sources. + public QueryFilters Filters { get; set; } + /// To configure Answer span prediction feature. + public ShortAnswerConfig ShortAnswerOptions { get; set; } + /// (Optional) Flag to enable Query over Unstructured Sources. + public bool? IncludeUnstructuredSources { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RangeKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RangeKind.cs new file mode 100644 index 0000000000000..21d430cd83221 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RangeKind.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The kind of range that the resolution object represents. + public readonly partial struct RangeKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RangeKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NumberValue = "Number"; + private const string SpeedValue = "Speed"; + private const string WeightValue = "Weight"; + private const string LengthValue = "Length"; + private const string VolumeValue = "Volume"; + private const string AreaValue = "Area"; + private const string AgeValue = "Age"; + private const string InformationValue = "Information"; + private const string TemperatureValue = "Temperature"; + private const string CurrencyValue = "Currency"; + + /// Number range. + public static RangeKind Number { get; } = new RangeKind(NumberValue); + /// Speed range. + public static RangeKind Speed { get; } = new RangeKind(SpeedValue); + /// Weight range. + public static RangeKind Weight { get; } = new RangeKind(WeightValue); + /// Length range. + public static RangeKind Length { get; } = new RangeKind(LengthValue); + /// Volume range. + public static RangeKind Volume { get; } = new RangeKind(VolumeValue); + /// Area range. + public static RangeKind Area { get; } = new RangeKind(AreaValue); + /// Age range. + public static RangeKind Age { get; } = new RangeKind(AgeValue); + /// Information range. + public static RangeKind Information { get; } = new RangeKind(InformationValue); + /// Temperature range. + public static RangeKind Temperature { get; } = new RangeKind(TemperatureValue); + /// Currency range. + public static RangeKind Currency { get; } = new RangeKind(CurrencyValue); + /// Determines if two values are the same. + public static bool operator ==(RangeKind left, RangeKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RangeKind left, RangeKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RangeKind(string value) => new RangeKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RangeKind other && Equals(other); + /// + public bool Equals(RangeKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RankerKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RankerKind.cs new file mode 100644 index 0000000000000..cb1d39a1c91be --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RankerKind.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.Conversations.Models +{ + /// Type of ranker to be used. + internal readonly partial struct RankerKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RankerKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string QuestionOnlyValue = "QuestionOnly"; + + /// Default ranker. + public static RankerKind Default { get; } = new RankerKind(DefaultValue); + /// Question only ranker. + public static RankerKind QuestionOnly { get; } = new RankerKind(QuestionOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(RankerKind left, RankerKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RankerKind left, RankerKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RankerKind(string value) => new RankerKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RankerKind other && Equals(other); + /// + public bool Equals(RankerKind 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.Conversations/src/Generated/Models/RedactedTranscriptContent.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactedTranscriptContent.Serialization.cs new file mode 100644 index 0000000000000..447a3c36038e7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactedTranscriptContent.Serialization.cs @@ -0,0 +1,202 @@ +// 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.Conversations.Models +{ + public partial class RedactedTranscriptContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedactedTranscriptContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(InverseTextNormalized)) + { + writer.WritePropertyName("itn"u8); + writer.WriteStringValue(InverseTextNormalized); + } + if (Optional.IsDefined(MaskedInverseTextNormalized)) + { + writer.WritePropertyName("maskedItn"u8); + writer.WriteStringValue(MaskedInverseTextNormalized); + } + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(Lexical)) + { + writer.WritePropertyName("lexical"u8); + writer.WriteStringValue(Lexical); + } + if (Optional.IsCollectionDefined(AudioTimings)) + { + writer.WritePropertyName("audioTimings"u8); + writer.WriteStartArray(); + foreach (var item in AudioTimings) + { + 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 + } + } + writer.WriteEndObject(); + } + + RedactedTranscriptContent 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(RedactedTranscriptContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedactedTranscriptContent(document.RootElement, options); + } + + internal static RedactedTranscriptContent DeserializeRedactedTranscriptContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string itn = default; + string maskedItn = default; + string text = default; + string lexical = default; + IReadOnlyList audioTimings = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("itn"u8)) + { + itn = property.Value.GetString(); + continue; + } + if (property.NameEquals("maskedItn"u8)) + { + maskedItn = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("lexical"u8)) + { + lexical = property.Value.GetString(); + continue; + } + if (property.NameEquals("audioTimings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AudioTiming.DeserializeAudioTiming(item, options)); + } + audioTimings = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RedactedTranscriptContent( + itn, + maskedItn, + text, + lexical, + audioTimings ?? 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(RedactedTranscriptContent)} does not support writing '{options.Format}' format."); + } + } + + RedactedTranscriptContent 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 DeserializeRedactedTranscriptContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedactedTranscriptContent)} 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 RedactedTranscriptContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRedactedTranscriptContent(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.Conversations/src/Generated/Models/RedactedTranscriptContent.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactedTranscriptContent.cs new file mode 100644 index 0000000000000..014c2adcfcce0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactedTranscriptContent.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.Conversations.Models +{ + /// Transcript content response that the service generates, with all necessary personally identifiable information redacted. + public partial class RedactedTranscriptContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RedactedTranscriptContent() + { + AudioTimings = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Redacted output for input in inverse-text-normalized format. + /// Redacted output for input in masked inverse-text-normalized format. + /// Redacted output for input in text (Microsoft's speech-to-text 'display') format. + /// Redacted output for input in lexical format. + /// List of redacted audio segments. + /// Keeps track of any properties unknown to the library. + internal RedactedTranscriptContent(string inverseTextNormalized, string maskedInverseTextNormalized, string text, string lexical, IReadOnlyList audioTimings, IDictionary serializedAdditionalRawData) + { + InverseTextNormalized = inverseTextNormalized; + MaskedInverseTextNormalized = maskedInverseTextNormalized; + Text = text; + Lexical = lexical; + AudioTimings = audioTimings; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Redacted output for input in inverse-text-normalized format. + public string InverseTextNormalized { get; } + /// Redacted output for input in masked inverse-text-normalized format. + public string MaskedInverseTextNormalized { get; } + /// Redacted output for input in text (Microsoft's speech-to-text 'display') format. + public string Text { get; } + /// Redacted output for input in lexical format. + public string Lexical { get; } + /// List of redacted audio segments. + public IReadOnlyList AudioTimings { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionCharacter.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RedactionCharacter.cs new file mode 100644 index 0000000000000..df3b98029aaa0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/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.Conversations.Models +{ + /// 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 string 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.Conversations/src/Generated/Models/RegexKey.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.Serialization.cs new file mode 100644 index 0000000000000..33f7536dd7ec7 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class RegexKey : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegexKey)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Key)) + { + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + } + if (Optional.IsDefined(RegexPattern)) + { + writer.WritePropertyName("regexPattern"u8); + writer.WriteStringValue(RegexPattern); + } + writer.WritePropertyName("extraInformationKind"u8); + writer.WriteStringValue(ExtraInformationKind.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 + } + } + writer.WriteEndObject(); + } + + RegexKey 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(RegexKey)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegexKey(document.RootElement, options); + } + + internal static RegexKey DeserializeRegexKey(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + string regexPattern = default; + ExtraInformationKind extraInformationKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("regexPattern"u8)) + { + regexPattern = property.Value.GetString(); + continue; + } + if (property.NameEquals("extraInformationKind"u8)) + { + extraInformationKind = new ExtraInformationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RegexKey(extraInformationKind, serializedAdditionalRawData, key, regexPattern); + } + + 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(RegexKey)} does not support writing '{options.Format}' format."); + } + } + + RegexKey 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 DeserializeRegexKey(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegexKey)} 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 RegexKey FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRegexKey(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.Conversations/src/Generated/Models/RegexKey.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs new file mode 100644 index 0000000000000..d0c65e7179d82 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RegexKey.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The regex key extra data kind. + public partial class RegexKey : ConversationEntityExtraInformation + { + /// Initializes a new instance of . + internal RegexKey() + { + ExtraInformationKind = ExtraInformationKind.RegexKey; + } + + /// Initializes a new instance of . + /// The extra information object kind. + /// Keeps track of any properties unknown to the library. + /// The key of the regex pattern used in extracting the entity. + /// The .NET regex pattern used in extracting the entity. Please visit https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. + internal RegexKey(ExtraInformationKind extraInformationKind, IDictionary serializedAdditionalRawData, string key, string regexPattern) : base(extraInformationKind, serializedAdditionalRawData) + { + Key = key; + RegexPattern = regexPattern; + } + + /// The key of the regex pattern used in extracting the entity. + public string Key { get; } + /// The .NET regex pattern used in extracting the entity. Please visit https://docs.microsoft.com/dotnet/standard/base-types/regular-expressions for more information about .NET regular expressions. + public string RegexPattern { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RelativeTo.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RelativeTo.cs new file mode 100644 index 0000000000000..c56427ba84f01 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RelativeTo.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The reference point that the ordinal number denotes. + public readonly partial struct RelativeTo : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RelativeTo(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CurrentValue = "Current"; + private const string EndValue = "End"; + private const string StartValue = "Start"; + + /// Current state. + public static RelativeTo Current { get; } = new RelativeTo(CurrentValue); + /// End state. + public static RelativeTo End { get; } = new RelativeTo(EndValue); + /// Start state. + public static RelativeTo Start { get; } = new RelativeTo(StartValue); + /// Determines if two values are the same. + public static bool operator ==(RelativeTo left, RelativeTo right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RelativeTo left, RelativeTo right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RelativeTo(string value) => new RelativeTo(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RelativeTo other && Equals(other); + /// + public bool Equals(RelativeTo other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RequestStatistics.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RequestStatistics.Serialization.cs new file mode 100644 index 0000000000000..1d288b348aefc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RequestStatistics.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.Conversations.Models +{ + public partial class RequestStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + 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.Conversations/src/Generated/Models/RequestStatistics.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/RequestStatistics.cs new file mode 100644 index 0000000000000..86fff5dd7cfe2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/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.Conversations.Models +{ + /// 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.Conversations/src/Generated/Models/ResolutionBase.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionBase.Serialization.cs new file mode 100644 index 0000000000000..2b48d2f9a811a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionBase.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.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownResolutionBase))] + public partial class ResolutionBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResolutionBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + ResolutionBase 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(ResolutionBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResolutionBase(document.RootElement, options); + } + + internal static ResolutionBase DeserializeResolutionBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("resolutionKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AgeResolution": return AgeResolution.DeserializeAgeResolution(element, options); + case "AreaResolution": return AreaResolution.DeserializeAreaResolution(element, options); + case "BooleanResolution": return BooleanResolution.DeserializeBooleanResolution(element, options); + case "CurrencyResolution": return CurrencyResolution.DeserializeCurrencyResolution(element, options); + case "DateTimeResolution": return DateTimeResolution.DeserializeDateTimeResolution(element, options); + case "InformationResolution": return InformationResolution.DeserializeInformationResolution(element, options); + case "LengthResolution": return LengthResolution.DeserializeLengthResolution(element, options); + case "NumberResolution": return NumberResolution.DeserializeNumberResolution(element, options); + case "NumericRangeResolution": return NumericRangeResolution.DeserializeNumericRangeResolution(element, options); + case "OrdinalResolution": return OrdinalResolution.DeserializeOrdinalResolution(element, options); + case "SpeedResolution": return SpeedResolution.DeserializeSpeedResolution(element, options); + case "TemperatureResolution": return TemperatureResolution.DeserializeTemperatureResolution(element, options); + case "TemporalSpanResolution": return TemporalSpanResolution.DeserializeTemporalSpanResolution(element, options); + case "VolumeResolution": return VolumeResolution.DeserializeVolumeResolution(element, options); + case "WeightResolution": return WeightResolution.DeserializeWeightResolution(element, options); + } + } + return UnknownResolutionBase.DeserializeUnknownResolutionBase(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(ResolutionBase)} does not support writing '{options.Format}' format."); + } + } + + ResolutionBase 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 DeserializeResolutionBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResolutionBase)} 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 ResolutionBase FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeResolutionBase(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.Conversations/src/Generated/Models/ResolutionBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionBase.cs new file mode 100644 index 0000000000000..0a0e7d947f31a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionBase.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.Conversations.Models +{ + /// + /// The abstract base class for entity resolutions. + /// 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 ResolutionBase + { + /// + /// 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 ResolutionBase() + { + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + internal ResolutionBase(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData) + { + ResolutionKind = resolutionKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity resolution object kind. + internal ResolutionKind ResolutionKind { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionKind.cs new file mode 100644 index 0000000000000..b42bf2f7f0764 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ResolutionKind.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The entity resolution object kind. + internal readonly partial struct ResolutionKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResolutionKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BooleanResolutionValue = "BooleanResolution"; + private const string DateTimeResolutionValue = "DateTimeResolution"; + private const string NumberResolutionValue = "NumberResolution"; + private const string OrdinalResolutionValue = "OrdinalResolution"; + private const string SpeedResolutionValue = "SpeedResolution"; + private const string WeightResolutionValue = "WeightResolution"; + private const string LengthResolutionValue = "LengthResolution"; + private const string VolumeResolutionValue = "VolumeResolution"; + private const string AreaResolutionValue = "AreaResolution"; + private const string AgeResolutionValue = "AgeResolution"; + private const string InformationResolutionValue = "InformationResolution"; + private const string TemperatureResolutionValue = "TemperatureResolution"; + private const string CurrencyResolutionValue = "CurrencyResolution"; + private const string NumericRangeResolutionValue = "NumericRangeResolution"; + private const string TemporalSpanResolutionValue = "TemporalSpanResolution"; + + /// Resolution of a boolean entity. + public static ResolutionKind BooleanResolution { get; } = new ResolutionKind(BooleanResolutionValue); + /// Resolution of a date/time entity. + public static ResolutionKind DateTimeResolution { get; } = new ResolutionKind(DateTimeResolutionValue); + /// Resolution of a number entity. + public static ResolutionKind NumberResolution { get; } = new ResolutionKind(NumberResolutionValue); + /// Resolution of an ordinal entity. + public static ResolutionKind OrdinalResolution { get; } = new ResolutionKind(OrdinalResolutionValue); + /// Resolution of a speed entity. + public static ResolutionKind SpeedResolution { get; } = new ResolutionKind(SpeedResolutionValue); + /// Resolution of a weight entity. + public static ResolutionKind WeightResolution { get; } = new ResolutionKind(WeightResolutionValue); + /// Resolution of a length entity. + public static ResolutionKind LengthResolution { get; } = new ResolutionKind(LengthResolutionValue); + /// Resolution of a volume entity. + public static ResolutionKind VolumeResolution { get; } = new ResolutionKind(VolumeResolutionValue); + /// Resolution of an area entity. + public static ResolutionKind AreaResolution { get; } = new ResolutionKind(AreaResolutionValue); + /// Resolution of an age entity. + public static ResolutionKind AgeResolution { get; } = new ResolutionKind(AgeResolutionValue); + /// Resolution of an information entity. + public static ResolutionKind InformationResolution { get; } = new ResolutionKind(InformationResolutionValue); + /// Resolution of a temperature entity. + public static ResolutionKind TemperatureResolution { get; } = new ResolutionKind(TemperatureResolutionValue); + /// Resolution of a currency entity. + public static ResolutionKind CurrencyResolution { get; } = new ResolutionKind(CurrencyResolutionValue); + /// Resolution of a numeric range entity. + public static ResolutionKind NumericRangeResolution { get; } = new ResolutionKind(NumericRangeResolutionValue); + /// Resolution of a temporal span entity. + public static ResolutionKind TemporalSpanResolution { get; } = new ResolutionKind(TemporalSpanResolutionValue); + /// Determines if two values are the same. + public static bool operator ==(ResolutionKind left, ResolutionKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResolutionKind left, ResolutionKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ResolutionKind(string value) => new ResolutionKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResolutionKind other && Equals(other); + /// + public bool Equals(ResolutionKind 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.Conversations/src/Generated/Models/ShortAnswerConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ShortAnswerConfig.Serialization.cs new file mode 100644 index 0000000000000..0c00f017bf1a8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ShortAnswerConfig.Serialization.cs @@ -0,0 +1,172 @@ +// 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.Conversations.Models +{ + internal partial class ShortAnswerConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ShortAnswerConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Enable)) + { + writer.WritePropertyName("enable"u8); + writer.WriteBooleanValue(Enable.Value); + } + if (Optional.IsDefined(ConfidenceThreshold)) + { + writer.WritePropertyName("confidenceScoreThreshold"u8); + writer.WriteNumberValue(ConfidenceThreshold.Value); + } + if (Optional.IsDefined(Top)) + { + writer.WritePropertyName("topAnswersWithSpan"u8); + writer.WriteNumberValue(Top.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 + } + } + writer.WriteEndObject(); + } + + ShortAnswerConfig 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(ShortAnswerConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeShortAnswerConfig(document.RootElement, options); + } + + internal static ShortAnswerConfig DeserializeShortAnswerConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enable = default; + double? confidenceScoreThreshold = default; + int? topAnswersWithSpan = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enable"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enable = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("confidenceScoreThreshold"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScoreThreshold = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("topAnswersWithSpan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + topAnswersWithSpan = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ShortAnswerConfig(enable, confidenceScoreThreshold, topAnswersWithSpan, 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(ShortAnswerConfig)} does not support writing '{options.Format}' format."); + } + } + + ShortAnswerConfig 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 DeserializeShortAnswerConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ShortAnswerConfig)} 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 ShortAnswerConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeShortAnswerConfig(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.Conversations/src/Generated/Models/ShortAnswerConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ShortAnswerConfig.cs new file mode 100644 index 0000000000000..a297dc95067dd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/ShortAnswerConfig.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.Conversations.Models +{ + /// To configure Answer span prediction feature. + internal partial class ShortAnswerConfig + { + /// + /// 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 ShortAnswerConfig() + { + } + + /// Initializes a new instance of . + /// Enable or disable Answer Span prediction. + /// Minimum threshold score required to include an answer span, value ranges from 0 to 1. + /// Number of Top answers to be considered for span prediction from 1 to 10. + /// Keeps track of any properties unknown to the library. + internal ShortAnswerConfig(bool? enable, double? confidenceThreshold, int? top, IDictionary serializedAdditionalRawData) + { + Enable = enable; + ConfidenceThreshold = confidenceThreshold; + Top = top; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Enable or disable Answer Span prediction. + public bool? Enable { get; set; } + /// Minimum threshold score required to include an answer span, value ranges from 0 to 1. + public double? ConfidenceThreshold { get; set; } + /// Number of Top answers to be considered for span prediction from 1 to 10. + public int? Top { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.Serialization.cs new file mode 100644 index 0000000000000..940a8c1bedd18 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class SpeedResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SpeedResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + SpeedResolution 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(SpeedResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSpeedResolution(document.RootElement, options); + } + + internal static SpeedResolution DeserializeSpeedResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + SpeedUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new SpeedUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SpeedResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SpeedResolution)} does not support writing '{options.Format}' format."); + } + } + + SpeedResolution 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 DeserializeSpeedResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SpeedResolution)} 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 SpeedResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSpeedResolution(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.Conversations/src/Generated/Models/SpeedResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.cs new file mode 100644 index 0000000000000..0340f7e1e76da --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the speed entity resolution model. + public partial class SpeedResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The speed Unit of measurement. + internal SpeedResolution(double value, SpeedUnit unit) + { + ResolutionKind = ResolutionKind.SpeedResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The speed Unit of measurement. + internal SpeedResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, SpeedUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal SpeedResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The speed Unit of measurement. + public SpeedUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedUnit.cs new file mode 100644 index 0000000000000..3137372d3312b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SpeedUnit.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The speed Unit of measurement. + public readonly partial struct SpeedUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SpeedUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string MetersPerSecondValue = "MetersPerSecond"; + private const string KilometersPerHourValue = "KilometersPerHour"; + private const string KilometersPerMinuteValue = "KilometersPerMinute"; + private const string KilometersPerSecondValue = "KilometersPerSecond"; + private const string MilesPerHourValue = "MilesPerHour"; + private const string KnotValue = "Knot"; + private const string FootPerSecondValue = "FootPerSecond"; + private const string FootPerMinuteValue = "FootPerMinute"; + private const string YardsPerMinuteValue = "YardsPerMinute"; + private const string YardsPerSecondValue = "YardsPerSecond"; + private const string MetersPerMillisecondValue = "MetersPerMillisecond"; + private const string CentimetersPerMillisecondValue = "CentimetersPerMillisecond"; + private const string KilometersPerMillisecondValue = "KilometersPerMillisecond"; + + /// Unspecified speed unit. + public static SpeedUnit Unspecified { get; } = new SpeedUnit(UnspecifiedValue); + /// Meters per second speed unit. + public static SpeedUnit MetersPerSecond { get; } = new SpeedUnit(MetersPerSecondValue); + /// Kilometers per hour speed unit. + public static SpeedUnit KilometersPerHour { get; } = new SpeedUnit(KilometersPerHourValue); + /// Kilometers per minute speed unit. + public static SpeedUnit KilometersPerMinute { get; } = new SpeedUnit(KilometersPerMinuteValue); + /// Kilometers per second speed unit. + public static SpeedUnit KilometersPerSecond { get; } = new SpeedUnit(KilometersPerSecondValue); + /// Miles per hour speed unit. + public static SpeedUnit MilesPerHour { get; } = new SpeedUnit(MilesPerHourValue); + /// Knot speed unit. + public static SpeedUnit Knot { get; } = new SpeedUnit(KnotValue); + /// Foot per second speed unit. + public static SpeedUnit FootPerSecond { get; } = new SpeedUnit(FootPerSecondValue); + /// Foot per minute speed unit. + public static SpeedUnit FootPerMinute { get; } = new SpeedUnit(FootPerMinuteValue); + /// Yards per minute speed unit. + public static SpeedUnit YardsPerMinute { get; } = new SpeedUnit(YardsPerMinuteValue); + /// Yards per second speed unit. + public static SpeedUnit YardsPerSecond { get; } = new SpeedUnit(YardsPerSecondValue); + /// Meters per millisecond speed unit. + public static SpeedUnit MetersPerMillisecond { get; } = new SpeedUnit(MetersPerMillisecondValue); + /// Centimeters per millisecond speed unit. + public static SpeedUnit CentimetersPerMillisecond { get; } = new SpeedUnit(CentimetersPerMillisecondValue); + /// Kilometers per millisecond speed unit. + public static SpeedUnit KilometersPerMillisecond { get; } = new SpeedUnit(KilometersPerMillisecondValue); + /// Determines if two values are the same. + public static bool operator ==(SpeedUnit left, SpeedUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SpeedUnit left, SpeedUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SpeedUnit(string value) => new SpeedUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SpeedUnit other && Equals(other); + /// + public bool Equals(SpeedUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/StringIndexType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/StringIndexType.cs new file mode 100644 index 0000000000000..06db3cb2e60d8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/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.Conversations.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. + 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 string 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.Conversations/src/Generated/Models/SummarizationOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..0f6ddc5ad3ef4 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationAction.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.Conversations.Models +{ + public partial class SummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummarizationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + SummarizationOperationAction 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(SummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSummarizationOperationAction(document.RootElement, options); + } + + internal static SummarizationOperationAction DeserializeSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeConversationOperationActionKind 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 = ConversationSummarizationActionContent.DeserializeConversationSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SummarizationOperationAction(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(SummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + SummarizationOperationAction 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 DeserializeSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SummarizationOperationAction)} 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 SummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSummarizationOperationAction(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.Conversations/src/Generated/Models/SummarizationOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationAction.cs new file mode 100644 index 0000000000000..c354eade1355b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationAction.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.Conversations.Models +{ + /// Task definition for conversational summarization. + public partial class SummarizationOperationAction : AnalyzeConversationOperationAction + { + /// Initializes a new instance of . + public SummarizationOperationAction() + { + Kind = AnalyzeConversationOperationActionKind.ConversationalSummarizationTask; + } + + /// Initializes a new instance of . + /// task name. + /// Enumeration of supported analysis tasks on a collection of conversations. + /// Keeps track of any properties unknown to the library. + /// parameters. + internal SummarizationOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData, ConversationSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// parameters. + public ConversationSummarizationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..224b70a4df325 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// 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.Conversations.Models +{ + public partial class SummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummarizationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SummarizationOperationResult 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(SummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSummarizationOperationResult(document.RootElement, options); + } + + internal static SummarizationOperationResult DeserializeSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SummaryResult results = default; + DateTimeOffset lastUpdateDateTime = default; + ConversationActionState status = default; + string taskName = default; + AnalyzeConversationOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = SummaryResult.DeserializeSummaryResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new ConversationActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SummarizationOperationResult( + 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(SummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + SummarizationOperationResult 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 DeserializeSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SummarizationOperationResult)} 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 SummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSummarizationOperationResult(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.Conversations/src/Generated/Models/SummarizationOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.cs new file mode 100644 index 0000000000000..33b9109b9343b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummarizationOperationResult.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.Conversations.Models +{ + /// Result for the summarization task on the conversation. + public partial class SummarizationOperationResult : AnalyzeConversationOperationResult + { + /// 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. + /// is null. + internal SummarizationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, SummaryResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeConversationOperationResultsKind.SummarizationOperationResults; + 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. + /// discriminator kind. + /// Keeps track of any properties unknown to the library. + /// results. + internal SummarizationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, string name, AnalyzeConversationOperationResultsKind kind, IDictionary serializedAdditionalRawData, SummaryResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal SummarizationOperationResult() + { + } + + /// results. + public SummaryResult Results { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryAspect.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryAspect.cs new file mode 100644 index 0000000000000..71bf545abaa4b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryAspect.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Supported parameters for a conversational summarization task. + public readonly partial struct SummaryAspect : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SummaryAspect(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IssueValue = "issue"; + private const string ResolutionValue = "resolution"; + private const string ChapterTitleValue = "chapterTitle"; + private const string NarrativeValue = "narrative"; + private const string RecapValue = "recap"; + private const string FollowUpTasksValue = "follow-up tasks"; + + /// Summary of issues in transcripts of web chats and service calls between customer-service agents and customers. + public static SummaryAspect Issue { get; } = new SummaryAspect(IssueValue); + /// Summary of resolutions in transcripts of web chats and service calls between customer-service agents and customers. + public static SummaryAspect Resolution { get; } = new SummaryAspect(ResolutionValue); + /// Chapter title of any conversation. It's usually one phrase or several phrases naturally combined. Long conversations tend to have more chapters. You can find the chapter boundary from the summary context. + public static SummaryAspect ChapterTitle { get; } = new SummaryAspect(ChapterTitleValue); + /// Generic narrative summary of any conversation. It generally converts the conversational language into formal written language, compresses the text length, and keeps the salient information. + public static SummaryAspect Narrative { get; } = new SummaryAspect(NarrativeValue); + /// A concise one-paragraph summary to provide a quick overview. + public static SummaryAspect Recap { get; } = new SummaryAspect(RecapValue); + /// Action items and tasks that arose during a meeting. + public static SummaryAspect FollowUpTasks { get; } = new SummaryAspect(FollowUpTasksValue); + /// Determines if two values are the same. + public static bool operator ==(SummaryAspect left, SummaryAspect right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SummaryAspect left, SummaryAspect right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SummaryAspect(string value) => new SummaryAspect(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SummaryAspect other && Equals(other); + /// + public bool Equals(SummaryAspect 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.Conversations/src/Generated/Models/SummaryLengthBucket.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryLengthBucket.cs new file mode 100644 index 0000000000000..610150c9eee11 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/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.Conversations.Models +{ + /// 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 string 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.Conversations/src/Generated/Models/SummaryResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResult.Serialization.cs new file mode 100644 index 0000000000000..3c561ccfc2341 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResult.Serialization.cs @@ -0,0 +1,186 @@ +// 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.Conversations.Models +{ + public partial class SummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("conversations"u8); + writer.WriteStartArray(); + foreach (var item in Conversations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SummaryResult 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(SummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSummaryResult(document.RootElement, options); + } + + internal static SummaryResult DeserializeSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList conversations = default; + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationsSummaryResult.DeserializeConversationsSummaryResult(item, options)); + } + conversations = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SummaryResult(conversations, errors, statistics, modelVersion, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SummaryResult)} does not support writing '{options.Format}' format."); + } + } + + SummaryResult 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 DeserializeSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SummaryResult)} 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 SummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSummaryResult(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.Conversations/src/Generated/Models/SummaryResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResult.cs new file mode 100644 index 0000000000000..fcc9d09e460a5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResult.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.Conversations.Models +{ + /// Summary Results. + public partial class SummaryResult + { + /// + /// 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 . + /// array of conversations. + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// , or is null. + internal SummaryResult(IEnumerable conversations, IEnumerable errors, string modelVersion) + { + Argument.AssertNotNull(conversations, nameof(conversations)); + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + + Conversations = conversations.ToList(); + Errors = errors.ToList(); + ModelVersion = modelVersion; + } + + /// Initializes a new instance of . + /// array of conversations. + /// Errors by document id. + /// statistics. + /// This field indicates which model is used for scoring. + /// Keeps track of any properties unknown to the library. + internal SummaryResult(IReadOnlyList conversations, IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IDictionary serializedAdditionalRawData) + { + Conversations = conversations; + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SummaryResult() + { + } + + /// array of conversations. + public IReadOnlyList Conversations { get; } + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// statistics. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.Serialization.cs new file mode 100644 index 0000000000000..3fd56471ea0fb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.Serialization.cs @@ -0,0 +1,168 @@ +// 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.Conversations.Models +{ + public partial class SummaryResultItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummaryResultItem)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("aspect"u8); + writer.WriteStringValue(Aspect); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (Optional.IsCollectionDefined(Contexts)) + { + writer.WritePropertyName("contexts"u8); + writer.WriteStartArray(); + foreach (var item in Contexts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SummaryResultItem 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(SummaryResultItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSummaryResultItem(document.RootElement, options); + } + + internal static SummaryResultItem DeserializeSummaryResultItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string aspect = default; + string text = default; + IReadOnlyList contexts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("aspect"u8)) + { + aspect = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("contexts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ItemizedSummaryContext.DeserializeItemizedSummaryContext(item, options)); + } + contexts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SummaryResultItem(aspect, text, contexts ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SummaryResultItem)} does not support writing '{options.Format}' format."); + } + } + + SummaryResultItem 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 DeserializeSummaryResultItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SummaryResultItem)} 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 SummaryResultItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSummaryResultItem(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.Conversations/src/Generated/Models/SummaryResultItem.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.cs new file mode 100644 index 0000000000000..9ef7ee38adb0f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/SummaryResultItem.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Summary Result Item. + public partial class SummaryResultItem + { + /// + /// 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 . + /// aspect. + /// text. + /// or is null. + internal SummaryResultItem(string aspect, string text) + { + Argument.AssertNotNull(aspect, nameof(aspect)); + Argument.AssertNotNull(text, nameof(text)); + + Aspect = aspect; + Text = text; + Contexts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// aspect. + /// text. + /// Context list of the summary. + /// Keeps track of any properties unknown to the library. + internal SummaryResultItem(string aspect, string text, IReadOnlyList contexts, IDictionary serializedAdditionalRawData) + { + Aspect = aspect; + Text = text; + Contexts = contexts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SummaryResultItem() + { + } + + /// aspect. + public string Aspect { get; } + /// text. + public string Text { get; } + /// Context list of the summary. + public IReadOnlyList Contexts { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.Serialization.cs new file mode 100644 index 0000000000000..68cba7b83f6ca --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.Serialization.cs @@ -0,0 +1,136 @@ +// 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.Conversations.Models +{ + [PersistableModelProxy(typeof(UnknownTargetIntentResult))] + public partial class TargetIntentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetIntentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + TargetIntentResult 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(TargetIntentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetIntentResult(document.RootElement, options); + } + + internal static TargetIntentResult DeserializeTargetIntentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("targetProjectKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "Conversation": return ConversationTargetIntentResult.DeserializeConversationTargetIntentResult(element, options); + case "Luis": return LuisTargetIntentResult.DeserializeLuisTargetIntentResult(element, options); + case "NonLinked": return NoneLinkedTargetIntentResult.DeserializeNoneLinkedTargetIntentResult(element, options); + case "QuestionAnswering": return QuestionAnsweringTargetIntentResult.DeserializeQuestionAnsweringTargetIntentResult(element, options); + } + } + return UnknownTargetIntentResult.DeserializeUnknownTargetIntentResult(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(TargetIntentResult)} does not support writing '{options.Format}' format."); + } + } + + TargetIntentResult 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 DeserializeTargetIntentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetIntentResult)} 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 TargetIntentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTargetIntentResult(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.Conversations/src/Generated/Models/TargetIntentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.cs new file mode 100644 index 0000000000000..b9569d25cf1b8 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetIntentResult.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// + /// This is the base class of an intent prediction + /// 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 TargetIntentResult + { + /// + /// 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 prediction score and it ranges from 0.0 to 1.0. + protected TargetIntentResult(double confidence) + { + Confidence = confidence; + } + + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + internal TargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, IDictionary serializedAdditionalRawData) + { + TargetProjectKind = targetProjectKind; + ApiVersion = apiVersion; + Confidence = confidence; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetIntentResult() + { + } + + /// This is the base class of an intent prediction. + internal TargetProjectKind TargetProjectKind { get; set; } + /// The API version used to call a target service. + public string ApiVersion { get; } + /// The prediction score and it ranges from 0.0 to 1.0. + public double Confidence { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetProjectKind.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetProjectKind.cs new file mode 100644 index 0000000000000..5e55666eb9564 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TargetProjectKind.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The type of a target service. + internal readonly partial struct TargetProjectKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TargetProjectKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LuisValue = "Luis"; + private const string ConversationValue = "Conversation"; + private const string QuestionAnsweringValue = "QuestionAnswering"; + private const string NonLinkedValue = "NonLinked"; + + /// Luis target service type. + public static TargetProjectKind Luis { get; } = new TargetProjectKind(LuisValue); + /// Conversation target service type. + public static TargetProjectKind Conversation { get; } = new TargetProjectKind(ConversationValue); + /// QuestionAnswering target service type. + public static TargetProjectKind QuestionAnswering { get; } = new TargetProjectKind(QuestionAnsweringValue); + /// NonLinked target service type. + public static TargetProjectKind NonLinked { get; } = new TargetProjectKind(NonLinkedValue); + /// Determines if two values are the same. + public static bool operator ==(TargetProjectKind left, TargetProjectKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TargetProjectKind left, TargetProjectKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TargetProjectKind(string value) => new TargetProjectKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TargetProjectKind other && Equals(other); + /// + public bool Equals(TargetProjectKind 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.Conversations/src/Generated/Models/TemperatureResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureResolution.Serialization.cs new file mode 100644 index 0000000000000..1a8256e8d09b3 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class TemperatureResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemperatureResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + TemperatureResolution 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(TemperatureResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemperatureResolution(document.RootElement, options); + } + + internal static TemperatureResolution DeserializeTemperatureResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + TemperatureUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new TemperatureUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemperatureResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemperatureResolution)} does not support writing '{options.Format}' format."); + } + } + + TemperatureResolution 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 DeserializeTemperatureResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemperatureResolution)} 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 TemperatureResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemperatureResolution(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.Conversations/src/Generated/Models/TemperatureResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureResolution.cs new file mode 100644 index 0000000000000..f6a6f849339be --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the temperature entity resolution model. + public partial class TemperatureResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The temperature Unit of measurement. + internal TemperatureResolution(double value, TemperatureUnit unit) + { + ResolutionKind = ResolutionKind.TemperatureResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The temperature Unit of measurement. + internal TemperatureResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, TemperatureUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal TemperatureResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The temperature Unit of measurement. + public TemperatureUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureUnit.cs new file mode 100644 index 0000000000000..84f24920bf5c5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemperatureUnit.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The temperature Unit of measurement. + public readonly partial struct TemperatureUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemperatureUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string FahrenheitValue = "Fahrenheit"; + private const string KelvinValue = "Kelvin"; + private const string RankineValue = "Rankine"; + private const string CelsiusValue = "Celsius"; + + /// Unspecified temperature unit. + public static TemperatureUnit Unspecified { get; } = new TemperatureUnit(UnspecifiedValue); + /// Fahrenheit temperature unit. + public static TemperatureUnit Fahrenheit { get; } = new TemperatureUnit(FahrenheitValue); + /// Kelvin temperature unit. + public static TemperatureUnit Kelvin { get; } = new TemperatureUnit(KelvinValue); + /// Rankine temperature unit. + public static TemperatureUnit Rankine { get; } = new TemperatureUnit(RankineValue); + /// Celsius temperature unit. + public static TemperatureUnit Celsius { get; } = new TemperatureUnit(CelsiusValue); + /// Determines if two values are the same. + public static bool operator ==(TemperatureUnit left, TemperatureUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemperatureUnit left, TemperatureUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TemperatureUnit(string value) => new TemperatureUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemperatureUnit other && Equals(other); + /// + public bool Equals(TemperatureUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalModifier.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalModifier.cs new file mode 100644 index 0000000000000..72234fec8434c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalModifier.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// An optional modifier of a date/time instance. + public readonly partial struct TemporalModifier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemporalModifier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AfterApproximateValue = "AfterApprox"; + private const string BeforeValue = "Before"; + private const string BeforeStartValue = "BeforeStart"; + private const string ApproximateValue = "Approx"; + private const string ReferenceUndefinedValue = "ReferenceUndefined"; + private const string SinceEndValue = "SinceEnd"; + private const string AfterMidValue = "AfterMid"; + private const string StartValue = "Start"; + private const string AfterValue = "After"; + private const string BeforeEndValue = "BeforeEnd"; + private const string UntilValue = "Until"; + private const string EndValue = "End"; + private const string LessValue = "Less"; + private const string SinceValue = "Since"; + private const string AfterStartValue = "AfterStart"; + private const string BeforeApproximateValue = "BeforeApprox"; + private const string MidValue = "Mid"; + private const string MoreValue = "More"; + + /// AfterApprox temporal modifier. + public static TemporalModifier AfterApproximate { get; } = new TemporalModifier(AfterApproximateValue); + /// Before temporal modifier. + public static TemporalModifier Before { get; } = new TemporalModifier(BeforeValue); + /// BeforeStart temporal modifier. + public static TemporalModifier BeforeStart { get; } = new TemporalModifier(BeforeStartValue); + /// Approx temporal modifier. + public static TemporalModifier Approximate { get; } = new TemporalModifier(ApproximateValue); + /// ReferenceUndefined temporal modifier. + public static TemporalModifier ReferenceUndefined { get; } = new TemporalModifier(ReferenceUndefinedValue); + /// SinceEnd temporal modifier. + public static TemporalModifier SinceEnd { get; } = new TemporalModifier(SinceEndValue); + /// AfterMid temporal modifier. + public static TemporalModifier AfterMid { get; } = new TemporalModifier(AfterMidValue); + /// Start temporal modifier. + public static TemporalModifier Start { get; } = new TemporalModifier(StartValue); + /// After temporal modifier. + public static TemporalModifier After { get; } = new TemporalModifier(AfterValue); + /// BeforeEnd temporal modifier. + public static TemporalModifier BeforeEnd { get; } = new TemporalModifier(BeforeEndValue); + /// Until temporal modifier. + public static TemporalModifier Until { get; } = new TemporalModifier(UntilValue); + /// End temporal modifier. + public static TemporalModifier End { get; } = new TemporalModifier(EndValue); + /// Less temporal modifier. + public static TemporalModifier Less { get; } = new TemporalModifier(LessValue); + /// Since temporal modifier. + public static TemporalModifier Since { get; } = new TemporalModifier(SinceValue); + /// AfterStart temporal modifier. + public static TemporalModifier AfterStart { get; } = new TemporalModifier(AfterStartValue); + /// BeforeApprox temporal modifier. + public static TemporalModifier BeforeApproximate { get; } = new TemporalModifier(BeforeApproximateValue); + /// Mid temporal modifier. + public static TemporalModifier Mid { get; } = new TemporalModifier(MidValue); + /// More temporal modifier. + public static TemporalModifier More { get; } = new TemporalModifier(MoreValue); + /// Determines if two values are the same. + public static bool operator ==(TemporalModifier left, TemporalModifier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemporalModifier left, TemporalModifier right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TemporalModifier(string value) => new TemporalModifier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemporalModifier other && Equals(other); + /// + public bool Equals(TemporalModifier other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.Serialization.cs new file mode 100644 index 0000000000000..873c4b2bb5661 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.Serialization.cs @@ -0,0 +1,201 @@ +// 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.Conversations.Models +{ + public partial class TemporalSpanResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Begin)) + { + writer.WritePropertyName("begin"u8); + writer.WriteStringValue(Begin); + } + if (Optional.IsDefined(End)) + { + writer.WritePropertyName("end"u8); + writer.WriteStringValue(End); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(Modifier)) + { + writer.WritePropertyName("modifier"u8); + writer.WriteStringValue(Modifier.Value.ToString()); + } + if (Optional.IsDefined(Timex)) + { + writer.WritePropertyName("timex"u8); + writer.WriteStringValue(Timex); + } + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + TemporalSpanResolution 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(TemporalSpanResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSpanResolution(document.RootElement, options); + } + + internal static TemporalSpanResolution DeserializeTemporalSpanResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string begin = default; + string end = default; + string duration = default; + TemporalModifier? modifier = default; + string timex = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("begin"u8)) + { + begin = property.Value.GetString(); + continue; + } + if (property.NameEquals("end"u8)) + { + end = property.Value.GetString(); + continue; + } + if (property.NameEquals("duration"u8)) + { + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("modifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifier = new TemporalModifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("timex"u8)) + { + timex = property.Value.GetString(); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSpanResolution( + resolutionKind, + serializedAdditionalRawData, + begin, + end, + duration, + modifier, + timex); + } + + 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(TemporalSpanResolution)} does not support writing '{options.Format}' format."); + } + } + + TemporalSpanResolution 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 DeserializeTemporalSpanResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSpanResolution)} 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 TemporalSpanResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSpanResolution(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.Conversations/src/Generated/Models/TemporalSpanResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.cs new file mode 100644 index 0000000000000..1096cde8c4e0b --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TemporalSpanResolution.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// represents the resolution of a date and/or time span. + public partial class TemporalSpanResolution : ResolutionBase + { + /// Initializes a new instance of . + internal TemporalSpanResolution() + { + ResolutionKind = ResolutionKind.TemporalSpanResolution; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// represents the resolution of a date and/or time span. An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// represents the resolution of a date and/or time span. An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + /// An optional modifier of a date/time instance. + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + internal TemporalSpanResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, string begin, string end, string duration, TemporalModifier? modifier, string timex) : base(resolutionKind, serializedAdditionalRawData) + { + Begin = begin; + End = end; + Duration = duration; + Modifier = modifier; + Timex = timex; + } + + /// represents the resolution of a date and/or time span. An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + public string Begin { get; } + /// represents the resolution of a date and/or time span. An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + public string End { get; } + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + public string Duration { get; } + /// An optional modifier of a date/time instance. + public TemporalModifier? Modifier { get; } + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + public string Timex { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.Serialization.cs new file mode 100644 index 0000000000000..25fb8a47515c5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class TextConversation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextConversation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("conversationItems"u8); + writer.WriteStartArray(); + foreach (var item in ConversationItems) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.ToString()); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TextConversation 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(TextConversation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextConversation(document.RootElement, options); + } + + internal static TextConversation DeserializeTextConversation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList conversationItems = default; + string id = default; + string language = default; + InputModality modality = default; + ConversationDomain? domain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversationItems"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TextConversationItem.DeserializeTextConversationItem(item, options)); + } + conversationItems = array; + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("modality"u8)) + { + modality = new InputModality(property.Value.GetString()); + continue; + } + if (property.NameEquals("domain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domain = new ConversationDomain(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextConversation( + id, + language, + modality, + domain, + serializedAdditionalRawData, + conversationItems); + } + + 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(TextConversation)} does not support writing '{options.Format}' format."); + } + } + + TextConversation 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 DeserializeTextConversation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextConversation)} 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 TextConversation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextConversation(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.Conversations/src/Generated/Models/TextConversation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.cs new file mode 100644 index 0000000000000..6df41d69d499a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversation.cs @@ -0,0 +1,52 @@ +// 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.Conversations.Models +{ + /// model for text conversation. + public partial class TextConversation : ConversationInput + { + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// Ordered list of text conversation items in the conversation. + /// , or is null. + public TextConversation(string id, string language, IEnumerable conversationItems) : base(id, language) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(language, nameof(language)); + Argument.AssertNotNull(conversationItems, nameof(conversationItems)); + + Modality = InputModality.Text; + ConversationItems = conversationItems.ToList(); + } + + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// modality. + /// domain. + /// Keeps track of any properties unknown to the library. + /// Ordered list of text conversation items in the conversation. + internal TextConversation(string id, string language, InputModality modality, ConversationDomain? domain, IDictionary serializedAdditionalRawData, IList conversationItems) : base(id, language, modality, domain, serializedAdditionalRawData) + { + ConversationItems = conversationItems; + } + + /// Initializes a new instance of for deserialization. + internal TextConversation() + { + } + + /// Ordered list of text conversation items in the conversation. + public IList ConversationItems { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.Serialization.cs new file mode 100644 index 0000000000000..8889098ee45b5 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class TextConversationItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextConversationItem)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("participantId"u8); + writer.WriteStringValue(ParticipantId); + if (Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + } + if (Optional.IsDefined(Modality)) + { + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.Value.ToString()); + } + if (Optional.IsDefined(Role)) + { + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.Value.ToString()); + } + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + 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 + } + } + writer.WriteEndObject(); + } + + TextConversationItem 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(TextConversationItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextConversationItem(document.RootElement, options); + } + + internal static TextConversationItem DeserializeTextConversationItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string participantId = default; + string language = default; + InputModality? modality = default; + ParticipantRole? role = default; + string text = 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("participantId"u8)) + { + participantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("modality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modality = new InputModality(property.Value.GetString()); + continue; + } + if (property.NameEquals("role"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + role = new ParticipantRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextConversationItem( + id, + participantId, + language, + modality, + role, + text, + 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(TextConversationItem)} does not support writing '{options.Format}' format."); + } + } + + TextConversationItem 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 DeserializeTextConversationItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextConversationItem)} 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 TextConversationItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextConversationItem(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.Conversations/src/Generated/Models/TextConversationItem.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.cs new file mode 100644 index 0000000000000..d2853e8393936 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TextConversationItem.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The text modality of an input conversation. + public partial class TextConversationItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// The text input. + /// , or is null. + public TextConversationItem(string id, string participantId, string text) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(participantId, nameof(participantId)); + Argument.AssertNotNull(text, nameof(text)); + + Id = id; + ParticipantId = participantId; + Text = text; + } + + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// The override language of a conversation item in BCP 47 language representation. + /// Enumeration of supported conversational modalities. + /// Role of the participant. + /// The text input. + /// Keeps track of any properties unknown to the library. + internal TextConversationItem(string id, string participantId, string language, InputModality? modality, ParticipantRole? role, string text, IDictionary serializedAdditionalRawData) + { + Id = id; + ParticipantId = participantId; + Language = language; + Modality = modality; + Role = role; + Text = text; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextConversationItem() + { + } + + /// The ID of a conversation item. + public string Id { get; } + /// The participant ID of a conversation item. + public string ParticipantId { get; } + /// The override language of a conversation item in BCP 47 language representation. + public string Language { get; set; } + /// Enumeration of supported conversational modalities. + public InputModality? Modality { get; set; } + /// Role of the participant. + public ParticipantRole? Role { get; set; } + /// The text input. + public string Text { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptContentType.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptContentType.cs new file mode 100644 index 0000000000000..f86c684276cb2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptContentType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Enumeration of supported transcript content types. + public readonly partial struct TranscriptContentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TranscriptContentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LexicalValue = "lexical"; + private const string ItnValue = "itn"; + private const string MaskedItnValue = "maskedItn"; + private const string TextValue = "text"; + + /// Lexical content type. + public static TranscriptContentType Lexical { get; } = new TranscriptContentType(LexicalValue); + /// ITN content type. + public static TranscriptContentType Itn { get; } = new TranscriptContentType(ItnValue); + /// Masked ITN content type. + public static TranscriptContentType MaskedItn { get; } = new TranscriptContentType(MaskedItnValue); + /// Text content type. + public static TranscriptContentType Text { get; } = new TranscriptContentType(TextValue); + /// Determines if two values are the same. + public static bool operator ==(TranscriptContentType left, TranscriptContentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TranscriptContentType left, TranscriptContentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TranscriptContentType(string value) => new TranscriptContentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TranscriptContentType other && Equals(other); + /// + public bool Equals(TranscriptContentType 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.Conversations/src/Generated/Models/TranscriptConversation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversation.Serialization.cs new file mode 100644 index 0000000000000..b4bbd33db5880 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversation.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class TranscriptConversation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TranscriptConversation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("conversationItems"u8); + writer.WriteStartArray(); + foreach (var item in ConversationItems) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.ToString()); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TranscriptConversation 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(TranscriptConversation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTranscriptConversation(document.RootElement, options); + } + + internal static TranscriptConversation DeserializeTranscriptConversation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList conversationItems = default; + string id = default; + string language = default; + InputModality modality = default; + ConversationDomain? domain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversationItems"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TranscriptConversationItem.DeserializeTranscriptConversationItem(item, options)); + } + conversationItems = array; + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("modality"u8)) + { + modality = new InputModality(property.Value.GetString()); + continue; + } + if (property.NameEquals("domain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domain = new ConversationDomain(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TranscriptConversation( + id, + language, + modality, + domain, + serializedAdditionalRawData, + conversationItems); + } + + 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(TranscriptConversation)} does not support writing '{options.Format}' format."); + } + } + + TranscriptConversation 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 DeserializeTranscriptConversation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TranscriptConversation)} 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 TranscriptConversation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTranscriptConversation(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.Conversations/src/Generated/Models/TranscriptConversation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversation.cs new file mode 100644 index 0000000000000..66d2dd8a83d23 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversation.cs @@ -0,0 +1,52 @@ +// 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.Conversations.Models +{ + /// model for transcript conversation. + public partial class TranscriptConversation : ConversationInput + { + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// Ordered list of transcript conversation items in the conversation. + /// , or is null. + public TranscriptConversation(string id, string language, IEnumerable conversationItems) : base(id, language) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(language, nameof(language)); + Argument.AssertNotNull(conversationItems, nameof(conversationItems)); + + Modality = InputModality.Transcript; + ConversationItems = conversationItems.ToList(); + } + + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// modality. + /// domain. + /// Keeps track of any properties unknown to the library. + /// Ordered list of transcript conversation items in the conversation. + internal TranscriptConversation(string id, string language, InputModality modality, ConversationDomain? domain, IDictionary serializedAdditionalRawData, IList conversationItems) : base(id, language, modality, domain, serializedAdditionalRawData) + { + ConversationItems = conversationItems; + } + + /// Initializes a new instance of for deserialization. + internal TranscriptConversation() + { + } + + /// Ordered list of transcript conversation items in the conversation. + public IList ConversationItems { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.Serialization.cs new file mode 100644 index 0000000000000..df69681720f1d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.Serialization.cs @@ -0,0 +1,268 @@ +// 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.Conversations.Models +{ + public partial class TranscriptConversationItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TranscriptConversationItem)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("participantId"u8); + writer.WriteStringValue(ParticipantId); + if (Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + } + if (Optional.IsDefined(Modality)) + { + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.Value.ToString()); + } + if (Optional.IsDefined(Role)) + { + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role.Value.ToString()); + } + writer.WritePropertyName("itn"u8); + writer.WriteStringValue(InverseTextNormalized); + writer.WritePropertyName("maskedItn"u8); + writer.WriteStringValue(MaskedInverseTextNormalized); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("lexical"u8); + writer.WriteStringValue(Lexical); + if (Optional.IsCollectionDefined(WordLevelTimings)) + { + writer.WritePropertyName("wordLevelTimings"u8); + writer.WriteStartArray(); + foreach (var item in WordLevelTimings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ConversationItemLevelTiming)) + { + writer.WritePropertyName("conversationItemLevelTiming"u8); + writer.WriteObjectValue(ConversationItemLevelTiming, 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 + } + } + writer.WriteEndObject(); + } + + TranscriptConversationItem 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(TranscriptConversationItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTranscriptConversationItem(document.RootElement, options); + } + + internal static TranscriptConversationItem DeserializeTranscriptConversationItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string participantId = default; + string language = default; + InputModality? modality = default; + ParticipantRole? role = default; + string itn = default; + string maskedItn = default; + string text = default; + string lexical = default; + IList wordLevelTimings = default; + ConversationItemLevelTiming conversationItemLevelTiming = 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("participantId"u8)) + { + participantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("modality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modality = new InputModality(property.Value.GetString()); + continue; + } + if (property.NameEquals("role"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + role = new ParticipantRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("itn"u8)) + { + itn = property.Value.GetString(); + continue; + } + if (property.NameEquals("maskedItn"u8)) + { + maskedItn = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("lexical"u8)) + { + lexical = property.Value.GetString(); + continue; + } + if (property.NameEquals("wordLevelTimings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WordLevelTiming.DeserializeWordLevelTiming(item, options)); + } + wordLevelTimings = array; + continue; + } + if (property.NameEquals("conversationItemLevelTiming"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + conversationItemLevelTiming = ConversationItemLevelTiming.DeserializeConversationItemLevelTiming(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TranscriptConversationItem( + id, + participantId, + language, + modality, + role, + itn, + maskedItn, + text, + lexical, + wordLevelTimings ?? new ChangeTrackingList(), + conversationItemLevelTiming, + 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(TranscriptConversationItem)} does not support writing '{options.Format}' format."); + } + } + + TranscriptConversationItem 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 DeserializeTranscriptConversationItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TranscriptConversationItem)} 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 TranscriptConversationItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTranscriptConversationItem(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.Conversations/src/Generated/Models/TranscriptConversationItem.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.cs new file mode 100644 index 0000000000000..5a7e164ba4f27 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/TranscriptConversationItem.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Additional properties for supporting transcript conversation. + public partial class TranscriptConversationItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// Inverse text normalization (ITN) representation of input. The inverse-text-normalized form is the recognized text from Microsoft's speech-to-text API, with phone numbers, numbers, abbreviations, and other transformations applied. + /// Inverse-text-normalized format with profanity masking applied. + /// Display form of the recognized text from the speech-to-text API, with punctuation and capitalization added. + /// Lexical form of the recognized text from the speech-to-text API, with the actual words recognized. + /// , , , , or is null. + public TranscriptConversationItem(string id, string participantId, string inverseTextNormalized, string maskedInverseTextNormalized, string text, string lexical) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(participantId, nameof(participantId)); + Argument.AssertNotNull(inverseTextNormalized, nameof(inverseTextNormalized)); + Argument.AssertNotNull(maskedInverseTextNormalized, nameof(maskedInverseTextNormalized)); + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(lexical, nameof(lexical)); + + Id = id; + ParticipantId = participantId; + InverseTextNormalized = inverseTextNormalized; + MaskedInverseTextNormalized = maskedInverseTextNormalized; + Text = text; + Lexical = lexical; + WordLevelTimings = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The ID of a conversation item. + /// The participant ID of a conversation item. + /// The override language of a conversation item in BCP 47 language representation. + /// Enumeration of supported conversational modalities. + /// Role of the participant. + /// Inverse text normalization (ITN) representation of input. The inverse-text-normalized form is the recognized text from Microsoft's speech-to-text API, with phone numbers, numbers, abbreviations, and other transformations applied. + /// Inverse-text-normalized format with profanity masking applied. + /// Display form of the recognized text from the speech-to-text API, with punctuation and capitalization added. + /// Lexical form of the recognized text from the speech-to-text API, with the actual words recognized. + /// List of word-level audio timing information. + /// Audio timing at the conversation item level. This still can help with AI quality if word-level audio timings are not available. + /// Keeps track of any properties unknown to the library. + internal TranscriptConversationItem(string id, string participantId, string language, InputModality? modality, ParticipantRole? role, string inverseTextNormalized, string maskedInverseTextNormalized, string text, string lexical, IList wordLevelTimings, ConversationItemLevelTiming conversationItemLevelTiming, IDictionary serializedAdditionalRawData) + { + Id = id; + ParticipantId = participantId; + Language = language; + Modality = modality; + Role = role; + InverseTextNormalized = inverseTextNormalized; + MaskedInverseTextNormalized = maskedInverseTextNormalized; + Text = text; + Lexical = lexical; + WordLevelTimings = wordLevelTimings; + ConversationItemLevelTiming = conversationItemLevelTiming; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TranscriptConversationItem() + { + } + + /// The ID of a conversation item. + public string Id { get; } + /// The participant ID of a conversation item. + public string ParticipantId { get; } + /// The override language of a conversation item in BCP 47 language representation. + public string Language { get; set; } + /// Enumeration of supported conversational modalities. + public InputModality? Modality { get; set; } + /// Role of the participant. + public ParticipantRole? Role { get; set; } + /// Inverse text normalization (ITN) representation of input. The inverse-text-normalized form is the recognized text from Microsoft's speech-to-text API, with phone numbers, numbers, abbreviations, and other transformations applied. + public string InverseTextNormalized { get; } + /// Inverse-text-normalized format with profanity masking applied. + public string MaskedInverseTextNormalized { get; } + /// Display form of the recognized text from the speech-to-text API, with punctuation and capitalization added. + public string Text { get; } + /// Lexical form of the recognized text from the speech-to-text API, with the actual words recognized. + public string Lexical { get; } + /// List of word-level audio timing information. + public IList WordLevelTimings { get; } + /// Audio timing at the conversation item level. This still can help with AI quality if word-level audio timings are not available. + public ConversationItemLevelTiming ConversationItemLevelTiming { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.Serialization.cs new file mode 100644 index 0000000000000..cd3691392d0f0 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.Serialization.cs @@ -0,0 +1,146 @@ +// 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.Conversations.Models +{ + internal partial class UnknownAnalysisConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalysisConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + 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 + } + } + writer.WriteEndObject(); + } + + AnalysisConfig 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(AnalysisConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalysisConfig(document.RootElement, options); + } + + internal static UnknownAnalysisConfig DeserializeUnknownAnalysisConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TargetProjectKind targetProjectKind = "Unknown"; + string apiVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalysisConfig(targetProjectKind, apiVersion, 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(AnalysisConfig)} does not support writing '{options.Format}' format."); + } + } + + AnalysisConfig 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 DeserializeAnalysisConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalysisConfig)} 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 UnknownAnalysisConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalysisConfig(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.Conversations/src/Generated/Models/UnknownAnalysisConfig.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.cs new file mode 100644 index 0000000000000..0309395b5a347 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalysisConfig.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.Conversations.Models +{ + /// Unknown version of AnalysisConfig. + internal partial class UnknownAnalysisConfig : AnalysisConfig + { + /// Initializes a new instance of . + /// The type of a target service. + /// The API version to use when call a specific target service. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalysisConfig(TargetProjectKind targetProjectKind, string apiVersion, IDictionary serializedAdditionalRawData) : base(targetProjectKind, apiVersion, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalysisConfig() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.Serialization.cs new file mode 100644 index 0000000000000..e08843b883526 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class UnknownAnalyzeConversationActionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationActionResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationActionResult 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(AnalyzeConversationActionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationActionResult(document.RootElement, options); + } + + internal static UnknownAnalyzeConversationActionResult DeserializeUnknownAnalyzeConversationActionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeConversationResultKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationResultKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeConversationActionResult(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(AnalyzeConversationActionResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationActionResult 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 DeserializeAnalyzeConversationActionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationActionResult)} 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 UnknownAnalyzeConversationActionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeConversationActionResult(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.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.cs new file mode 100644 index 0000000000000..f22c89e2980ac --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationActionResult.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.Conversations.Models +{ + /// Unknown version of AnalyzeConversationActionResult. + internal partial class UnknownAnalyzeConversationActionResult : AnalyzeConversationActionResult + { + /// Initializes a new instance of . + /// The base class of a conversation input task result. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeConversationActionResult(AnalyzeConversationResultKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeConversationActionResult() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.Serialization.cs new file mode 100644 index 0000000000000..03961eb64f43f --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class UnknownAnalyzeConversationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationInput 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(AnalyzeConversationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationInput(document.RootElement, options); + } + + internal static UnknownAnalyzeConversationInput DeserializeUnknownAnalyzeConversationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeConversationInputKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeConversationInput(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(AnalyzeConversationInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationInput 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 DeserializeAnalyzeConversationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationInput)} 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 UnknownAnalyzeConversationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeConversationInput(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.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.cs new file mode 100644 index 0000000000000..c9ffdb8904fca --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationInput.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.Conversations.Models +{ + /// Unknown version of AnalyzeConversationInput. + internal partial class UnknownAnalyzeConversationInput : AnalyzeConversationInput + { + /// Initializes a new instance of . + /// The base class of a conversation input task. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeConversationInput(AnalyzeConversationInputKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeConversationInput() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..60b81f57ea88c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.Serialization.cs @@ -0,0 +1,146 @@ +// 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.Conversations.Models +{ + internal partial class UnknownAnalyzeConversationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationOperationAction 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(AnalyzeConversationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationOperationAction(document.RootElement, options); + } + + internal static UnknownAnalyzeConversationOperationAction DeserializeUnknownAnalyzeConversationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string taskName = default; + AnalyzeConversationOperationActionKind 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 AnalyzeConversationOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeConversationOperationAction(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(AnalyzeConversationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationOperationAction 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 DeserializeAnalyzeConversationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationOperationAction)} 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 UnknownAnalyzeConversationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeConversationOperationAction(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.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.cs new file mode 100644 index 0000000000000..68fdcb379b5d2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationAction.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.Conversations.Models +{ + /// Unknown version of AnalyzeConversationOperationAction. + internal partial class UnknownAnalyzeConversationOperationAction : AnalyzeConversationOperationAction + { + /// Initializes a new instance of . + /// task name. + /// Enumeration of supported analysis tasks on a collection of conversations. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeConversationOperationAction(string name, AnalyzeConversationOperationActionKind kind, IDictionary serializedAdditionalRawData) : base(name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeConversationOperationAction() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..d0d622b196abb --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.Serialization.cs @@ -0,0 +1,162 @@ +// 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.Conversations.Models +{ + internal partial class UnknownAnalyzeConversationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeConversationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeConversationOperationResult 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(AnalyzeConversationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeConversationOperationResult(document.RootElement, options); + } + + internal static UnknownAnalyzeConversationOperationResult DeserializeUnknownAnalyzeConversationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset lastUpdateDateTime = default; + ConversationActionState status = default; + string taskName = default; + AnalyzeConversationOperationResultsKind 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 ConversationActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeConversationOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeConversationOperationResult(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(AnalyzeConversationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeConversationOperationResult 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 DeserializeAnalyzeConversationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeConversationOperationResult)} 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 UnknownAnalyzeConversationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeConversationOperationResult(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.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.cs new file mode 100644 index 0000000000000..c85176b808b5a --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownAnalyzeConversationOperationResult.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.Conversations.Models +{ + /// Unknown version of AnalyzeConversationOperationResult. + internal partial class UnknownAnalyzeConversationOperationResult : AnalyzeConversationOperationResult + { + /// 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. + /// discriminator kind. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeConversationOperationResult(DateTimeOffset lastUpdateDateTime, ConversationActionState status, string name, AnalyzeConversationOperationResultsKind kind, IDictionary serializedAdditionalRawData) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeConversationOperationResult() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.Serialization.cs new file mode 100644 index 0000000000000..09f6a996c7c98 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class UnknownConversationEntityExtraInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationEntityExtraInformation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("extraInformationKind"u8); + writer.WriteStringValue(ExtraInformationKind.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 + } + } + writer.WriteEndObject(); + } + + ConversationEntityExtraInformation 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(ConversationEntityExtraInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationEntityExtraInformation(document.RootElement, options); + } + + internal static UnknownConversationEntityExtraInformation DeserializeUnknownConversationEntityExtraInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExtraInformationKind extraInformationKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("extraInformationKind"u8)) + { + extraInformationKind = new ExtraInformationKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownConversationEntityExtraInformation(extraInformationKind, 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(ConversationEntityExtraInformation)} does not support writing '{options.Format}' format."); + } + } + + ConversationEntityExtraInformation 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 DeserializeConversationEntityExtraInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationEntityExtraInformation)} 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 UnknownConversationEntityExtraInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownConversationEntityExtraInformation(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.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.cs new file mode 100644 index 0000000000000..d0a3a49fe9a2d --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationEntityExtraInformation.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.Conversations.Models +{ + /// Unknown version of ConversationEntityExtraInformation. + internal partial class UnknownConversationEntityExtraInformation : ConversationEntityExtraInformation + { + /// Initializes a new instance of . + /// The extra information object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownConversationEntityExtraInformation(ExtraInformationKind extraInformationKind, IDictionary serializedAdditionalRawData) : base(extraInformationKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownConversationEntityExtraInformation() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.Serialization.cs new file mode 100644 index 0000000000000..045e929e14cec --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.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.Conversations.Models +{ + internal partial class UnknownConversationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + writer.WritePropertyName("modality"u8); + writer.WriteStringValue(Modality.ToString()); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConversationInput 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(ConversationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationInput(document.RootElement, options); + } + + internal static UnknownConversationInput DeserializeUnknownConversationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string language = default; + InputModality modality = "Unknown"; + ConversationDomain? domain = 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("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("modality"u8)) + { + modality = new InputModality(property.Value.GetString()); + continue; + } + if (property.NameEquals("domain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domain = new ConversationDomain(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownConversationInput(id, language, modality, domain, 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(ConversationInput)} does not support writing '{options.Format}' format."); + } + } + + ConversationInput 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 DeserializeConversationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationInput)} 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 UnknownConversationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownConversationInput(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.Conversations/src/Generated/Models/UnknownConversationInput.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.cs new file mode 100644 index 0000000000000..afb87110ffcc9 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownConversationInput.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.Conversations.Models +{ + /// Unknown version of ConversationInput. + internal partial class UnknownConversationInput : ConversationInput + { + /// Initializes a new instance of . + /// Unique identifier for the conversation. + /// Language of the conversation item in BCP-47 format. + /// modality. + /// domain. + /// Keeps track of any properties unknown to the library. + internal UnknownConversationInput(string id, string language, InputModality modality, ConversationDomain? domain, IDictionary serializedAdditionalRawData) : base(id, language, modality, domain, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownConversationInput() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.Serialization.cs new file mode 100644 index 0000000000000..817125a728ad2 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.Serialization.cs @@ -0,0 +1,146 @@ +// 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.Conversations.Models +{ + internal partial class UnknownPredictionBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PredictionBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("projectKind"u8); + writer.WriteStringValue(ProjectKind.ToString()); + if (Optional.IsDefined(TopIntent)) + { + writer.WritePropertyName("topIntent"u8); + writer.WriteStringValue(TopIntent); + } + 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 + } + } + writer.WriteEndObject(); + } + + PredictionBase 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(PredictionBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePredictionBase(document.RootElement, options); + } + + internal static UnknownPredictionBase DeserializeUnknownPredictionBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProjectKind projectKind = "Unknown"; + string topIntent = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("projectKind"u8)) + { + projectKind = new ProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("topIntent"u8)) + { + topIntent = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownPredictionBase(projectKind, topIntent, 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(PredictionBase)} does not support writing '{options.Format}' format."); + } + } + + PredictionBase 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 DeserializePredictionBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PredictionBase)} 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 UnknownPredictionBase FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownPredictionBase(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.Conversations/src/Generated/Models/UnknownPredictionBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.cs new file mode 100644 index 0000000000000..5a433806eafdf --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownPredictionBase.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.Conversations.Models +{ + /// Unknown version of PredictionBase. + internal partial class UnknownPredictionBase : PredictionBase + { + /// Initializes a new instance of . + /// The type of the project. + /// The intent with the highest score. + /// Keeps track of any properties unknown to the library. + internal UnknownPredictionBase(ProjectKind projectKind, string topIntent, IDictionary serializedAdditionalRawData) : base(projectKind, topIntent, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownPredictionBase() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.Serialization.cs new file mode 100644 index 0000000000000..5e9e2e4768b06 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + internal partial class UnknownResolutionBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResolutionBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + ResolutionBase 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(ResolutionBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResolutionBase(document.RootElement, options); + } + + internal static UnknownResolutionBase DeserializeUnknownResolutionBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResolutionKind resolutionKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownResolutionBase(resolutionKind, 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(ResolutionBase)} does not support writing '{options.Format}' format."); + } + } + + ResolutionBase 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 DeserializeResolutionBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResolutionBase)} 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 UnknownResolutionBase FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownResolutionBase(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.Conversations/src/Generated/Models/UnknownResolutionBase.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.cs new file mode 100644 index 0000000000000..44f276f99296c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownResolutionBase.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.Conversations.Models +{ + /// Unknown version of ResolutionBase. + internal partial class UnknownResolutionBase : ResolutionBase + { + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownResolutionBase(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData) : base(resolutionKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownResolutionBase() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.Serialization.cs new file mode 100644 index 0000000000000..3cd3cef0b71fd --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.Serialization.cs @@ -0,0 +1,154 @@ +// 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.Conversations.Models +{ + internal partial class UnknownTargetIntentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetIntentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("targetProjectKind"u8); + writer.WriteStringValue(TargetProjectKind.ToString()); + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(Confidence); + 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 + } + } + writer.WriteEndObject(); + } + + TargetIntentResult 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(TargetIntentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetIntentResult(document.RootElement, options); + } + + internal static UnknownTargetIntentResult DeserializeUnknownTargetIntentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TargetProjectKind targetProjectKind = "Unknown"; + string apiVersion = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetProjectKind"u8)) + { + targetProjectKind = new TargetProjectKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownTargetIntentResult(targetProjectKind, apiVersion, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetIntentResult)} does not support writing '{options.Format}' format."); + } + } + + TargetIntentResult 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 DeserializeTargetIntentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetIntentResult)} 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 UnknownTargetIntentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownTargetIntentResult(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.Conversations/src/Generated/Models/UnknownTargetIntentResult.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.cs new file mode 100644 index 0000000000000..faf9b86a4f173 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/UnknownTargetIntentResult.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Unknown version of TargetIntentResult. + internal partial class UnknownTargetIntentResult : TargetIntentResult + { + /// Initializes a new instance of . + /// This is the base class of an intent prediction. + /// The API version used to call a target service. + /// The prediction score and it ranges from 0.0 to 1.0. + /// Keeps track of any properties unknown to the library. + internal UnknownTargetIntentResult(TargetProjectKind targetProjectKind, string apiVersion, double confidence, IDictionary serializedAdditionalRawData) : base(targetProjectKind, apiVersion, confidence, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownTargetIntentResult() + { + } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.Serialization.cs new file mode 100644 index 0000000000000..fdd3fa0e810a6 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class VolumeResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + VolumeResolution 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(VolumeResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeResolution(document.RootElement, options); + } + + internal static VolumeResolution DeserializeVolumeResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + VolumeUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new VolumeUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeResolution)} does not support writing '{options.Format}' format."); + } + } + + VolumeResolution 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 DeserializeVolumeResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeResolution)} 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 VolumeResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeVolumeResolution(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.Conversations/src/Generated/Models/VolumeResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.cs new file mode 100644 index 0000000000000..e103b8aa66420 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the volume entity resolution model. + public partial class VolumeResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The Volume Unit of measurement. + internal VolumeResolution(double value, VolumeUnit unit) + { + ResolutionKind = ResolutionKind.VolumeResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The Volume Unit of measurement. + internal VolumeResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, VolumeUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal VolumeResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The Volume Unit of measurement. + public VolumeUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeUnit.cs new file mode 100644 index 0000000000000..c61c7c9498d40 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/VolumeUnit.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The Volume Unit of measurement. + public readonly partial struct VolumeUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VolumeUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string CubicMeterValue = "CubicMeter"; + private const string CubicCentimeterValue = "CubicCentimeter"; + private const string CubicMillimeterValue = "CubicMillimeter"; + private const string HectoliterValue = "Hectoliter"; + private const string DecaliterValue = "Decaliter"; + private const string LiterValue = "Liter"; + private const string CentiliterValue = "Centiliter"; + private const string MilliliterValue = "Milliliter"; + private const string CubicYardValue = "CubicYard"; + private const string CubicInchValue = "CubicInch"; + private const string CubicFootValue = "CubicFoot"; + private const string CubicMileValue = "CubicMile"; + private const string FluidOunceValue = "FluidOunce"; + private const string TeaspoonValue = "Teaspoon"; + private const string TablespoonValue = "Tablespoon"; + private const string PintValue = "Pint"; + private const string QuartValue = "Quart"; + private const string CupValue = "Cup"; + private const string GillValue = "Gill"; + private const string PinchValue = "Pinch"; + private const string FluidDramValue = "FluidDram"; + private const string BarrelValue = "Barrel"; + private const string MinimValue = "Minim"; + private const string CordValue = "Cord"; + private const string PeckValue = "Peck"; + private const string BushelValue = "Bushel"; + private const string HogsheadValue = "Hogshead"; + + /// Unspecified volume unit. + public static VolumeUnit Unspecified { get; } = new VolumeUnit(UnspecifiedValue); + /// Volume unit in cubic meters. + public static VolumeUnit CubicMeter { get; } = new VolumeUnit(CubicMeterValue); + /// Volume unit in cubic centimeters. + public static VolumeUnit CubicCentimeter { get; } = new VolumeUnit(CubicCentimeterValue); + /// Volume unit in cubic millimeters. + public static VolumeUnit CubicMillimeter { get; } = new VolumeUnit(CubicMillimeterValue); + /// Volume unit in hectoliters. + public static VolumeUnit Hectoliter { get; } = new VolumeUnit(HectoliterValue); + /// Volume unit in decaliters. + public static VolumeUnit Decaliter { get; } = new VolumeUnit(DecaliterValue); + /// Volume unit in liters. + public static VolumeUnit Liter { get; } = new VolumeUnit(LiterValue); + /// Volume unit in centiliters. + public static VolumeUnit Centiliter { get; } = new VolumeUnit(CentiliterValue); + /// Volume unit in milliliters. + public static VolumeUnit Milliliter { get; } = new VolumeUnit(MilliliterValue); + /// Volume unit in cubic yards. + public static VolumeUnit CubicYard { get; } = new VolumeUnit(CubicYardValue); + /// Volume unit in cubic inches. + public static VolumeUnit CubicInch { get; } = new VolumeUnit(CubicInchValue); + /// Volume unit in cubic feet. + public static VolumeUnit CubicFoot { get; } = new VolumeUnit(CubicFootValue); + /// Volume unit in cubic miles. + public static VolumeUnit CubicMile { get; } = new VolumeUnit(CubicMileValue); + /// Volume unit in fluid ounces. + public static VolumeUnit FluidOunce { get; } = new VolumeUnit(FluidOunceValue); + /// Volume unit in teaspoons. + public static VolumeUnit Teaspoon { get; } = new VolumeUnit(TeaspoonValue); + /// Volume unit in tablespoons. + public static VolumeUnit Tablespoon { get; } = new VolumeUnit(TablespoonValue); + /// Volume unit in pints. + public static VolumeUnit Pint { get; } = new VolumeUnit(PintValue); + /// Volume unit in quarts. + public static VolumeUnit Quart { get; } = new VolumeUnit(QuartValue); + /// Volume unit in cups. + public static VolumeUnit Cup { get; } = new VolumeUnit(CupValue); + /// Volume unit in gills. + public static VolumeUnit Gill { get; } = new VolumeUnit(GillValue); + /// Volume unit in pinches. + public static VolumeUnit Pinch { get; } = new VolumeUnit(PinchValue); + /// Volume unit in fluid drams. + public static VolumeUnit FluidDram { get; } = new VolumeUnit(FluidDramValue); + /// Volume unit in barrels. + public static VolumeUnit Barrel { get; } = new VolumeUnit(BarrelValue); + /// Volume unit in minims. + public static VolumeUnit Minim { get; } = new VolumeUnit(MinimValue); + /// Volume unit in cords. + public static VolumeUnit Cord { get; } = new VolumeUnit(CordValue); + /// Volume unit in pecks. + public static VolumeUnit Peck { get; } = new VolumeUnit(PeckValue); + /// Volume unit in bushels. + public static VolumeUnit Bushel { get; } = new VolumeUnit(BushelValue); + /// Volume unit in hogsheads. + public static VolumeUnit Hogshead { get; } = new VolumeUnit(HogsheadValue); + /// Determines if two values are the same. + public static bool operator ==(VolumeUnit left, VolumeUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VolumeUnit left, VolumeUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VolumeUnit(string value) => new VolumeUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeUnit other && Equals(other); + /// + public bool Equals(VolumeUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.Serialization.cs new file mode 100644 index 0000000000000..d47b38f3f92bc --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Conversations.Models +{ + public partial class WeightResolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeightResolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("resolutionKind"u8); + writer.WriteStringValue(ResolutionKind.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 + } + } + writer.WriteEndObject(); + } + + WeightResolution 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(WeightResolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWeightResolution(document.RootElement, options); + } + + internal static WeightResolution DeserializeWeightResolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + WeightUnit unit = default; + ResolutionKind resolutionKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new WeightUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("resolutionKind"u8)) + { + resolutionKind = new ResolutionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WeightResolution(resolutionKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WeightResolution)} does not support writing '{options.Format}' format."); + } + } + + WeightResolution 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 DeserializeWeightResolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WeightResolution)} 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 WeightResolution FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightResolution(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.Conversations/src/Generated/Models/WeightResolution.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.cs new file mode 100644 index 0000000000000..b2f8ada1d1d88 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightResolution.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Conversations.Models +{ + /// Represents the weight entity resolution model. + public partial class WeightResolution : ResolutionBase + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// The weight Unit of measurement. + internal WeightResolution(double value, WeightUnit unit) + { + ResolutionKind = ResolutionKind.WeightResolution; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity resolution object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// The weight Unit of measurement. + internal WeightResolution(ResolutionKind resolutionKind, IDictionary serializedAdditionalRawData, double value, WeightUnit unit) : base(resolutionKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal WeightResolution() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// The weight Unit of measurement. + public WeightUnit Unit { get; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightUnit.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightUnit.cs new file mode 100644 index 0000000000000..346910c6fba8e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WeightUnit.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Conversations.Models +{ + /// The weight Unit of measurement. + public readonly partial struct WeightUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WeightUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string KilogramValue = "Kilogram"; + private const string GramValue = "Gram"; + private const string MilligramValue = "Milligram"; + private const string GallonValue = "Gallon"; + private const string MetricTonValue = "MetricTon"; + private const string TonValue = "Ton"; + private const string PoundValue = "Pound"; + private const string OunceValue = "Ounce"; + private const string GrainValue = "Grain"; + private const string PennyWeightValue = "PennyWeight"; + private const string LongTonBritishValue = "LongTonBritish"; + private const string ShortTonUSValue = "ShortTonUS"; + private const string ShortHundredWeightUSValue = "ShortHundredWeightUS"; + private const string StoneValue = "Stone"; + private const string DramValue = "Dram"; + + /// Unspecified weight unit. + public static WeightUnit Unspecified { get; } = new WeightUnit(UnspecifiedValue); + /// Weight unit in kilograms. + public static WeightUnit Kilogram { get; } = new WeightUnit(KilogramValue); + /// Weight unit in grams. + public static WeightUnit Gram { get; } = new WeightUnit(GramValue); + /// Weight unit in milligrams. + public static WeightUnit Milligram { get; } = new WeightUnit(MilligramValue); + /// Volume unit in gallons. + public static WeightUnit Gallon { get; } = new WeightUnit(GallonValue); + /// Weight unit in metric tons. + public static WeightUnit MetricTon { get; } = new WeightUnit(MetricTonValue); + /// Weight unit in tons. + public static WeightUnit Ton { get; } = new WeightUnit(TonValue); + /// Weight unit in pounds. + public static WeightUnit Pound { get; } = new WeightUnit(PoundValue); + /// Weight unit in ounces. + public static WeightUnit Ounce { get; } = new WeightUnit(OunceValue); + /// Weight unit in grains. + public static WeightUnit Grain { get; } = new WeightUnit(GrainValue); + /// Weight unit in pennyweights. + public static WeightUnit PennyWeight { get; } = new WeightUnit(PennyWeightValue); + /// Weight unit in long tons (British). + public static WeightUnit LongTonBritish { get; } = new WeightUnit(LongTonBritishValue); + /// Weight unit in short tons (US). + public static WeightUnit ShortTonUS { get; } = new WeightUnit(ShortTonUSValue); + /// Weight unit in short hundredweights (US). + public static WeightUnit ShortHundredWeightUS { get; } = new WeightUnit(ShortHundredWeightUSValue); + /// Weight unit in stones. + public static WeightUnit Stone { get; } = new WeightUnit(StoneValue); + /// Weight unit in drams. + public static WeightUnit Dram { get; } = new WeightUnit(DramValue); + /// Determines if two values are the same. + public static bool operator ==(WeightUnit left, WeightUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WeightUnit left, WeightUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WeightUnit(string value) => new WeightUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WeightUnit other && Equals(other); + /// + public bool Equals(WeightUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.Serialization.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.Serialization.cs new file mode 100644 index 0000000000000..8afc0a4fd6630 --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.Serialization.cs @@ -0,0 +1,168 @@ +// 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.Conversations.Models +{ + public partial class WordLevelTiming : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WordLevelTiming)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Offset)) + { + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset.Value); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteNumberValue(Duration.Value); + } + if (Optional.IsDefined(Word)) + { + writer.WritePropertyName("word"u8); + writer.WriteStringValue(Word); + } + 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 + } + } + writer.WriteEndObject(); + } + + WordLevelTiming 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(WordLevelTiming)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWordLevelTiming(document.RootElement, options); + } + + internal static WordLevelTiming DeserializeWordLevelTiming(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? offset = default; + long? duration = default; + string word = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + offset = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("word"u8)) + { + word = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WordLevelTiming(offset, duration, word, 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(WordLevelTiming)} does not support writing '{options.Format}' format."); + } + } + + WordLevelTiming 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 DeserializeWordLevelTiming(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WordLevelTiming)} 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 WordLevelTiming FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWordLevelTiming(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.Conversations/src/Generated/Models/WordLevelTiming.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.cs new file mode 100644 index 0000000000000..8103d848a6c2e --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/Generated/Models/WordLevelTiming.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.Conversations.Models +{ + /// Word-level timing information that the speech-to-text API generates. The words in this object should have 1:1 correspondence with the lexical input to allow for audio redaction. + public partial class WordLevelTiming + { + /// + /// 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 WordLevelTiming() + { + } + + /// Initializes a new instance of . + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + /// Recognized word. + /// Keeps track of any properties unknown to the library. + internal WordLevelTiming(long? offset, long? duration, string word, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Duration = duration; + Word = word; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Offset from the start of speech audio, in ticks. 1 tick = 100 nanoseconds. + public long? Offset { get; set; } + /// Duration of word articulation, in ticks. 1 tick = 100 nanoseconds. + public long? Duration { get; set; } + /// Recognized word. + public string Word { get; set; } + } +} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md deleted file mode 100644 index 28852c081cc4a..0000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/src/autorest.md +++ /dev/null @@ -1,282 +0,0 @@ -# Generated code configuration - -Run `dotnet build /t:GenerateCode` to generate code. - -``` yaml -# The title here is used to generate the single ClientOptions class name. -title: Conversations -license-header: MICROSOFT_MIT_NO_VERSION - -input-file: -- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/53240ebc58b3c4e99de723194032064db1d97e63/specification/cognitiveservices/data-plane/Language/stable/2023-04-01/analyzeconversations.json -- https://raw.githubusercontent.com/Azure/azure-rest-api-specs/53240ebc58b3c4e99de723194032064db1d97e63/specification/cognitiveservices/data-plane/Language/stable/2023-04-01/analyzeconversations-authoring.json -clear-output-folder: true -keep-non-overloadable-protocol-signature: true - -data-plane: true -model-namespace: false - -add-credential: true -credential-scopes: https://cognitiveservices.azure.com/.default - -modelerfour: - lenient-model-deduplication: true -methods-to-keep-client-default-value: -- ConversationalAnalysisAuthoring_GetModelEvaluationResults -- ConversationalAnalysisAuthoring_ExportProject -``` - -## Customizations - -Customizations that should eventually be added to central autorest configuration. - -### General customizations - -``` yaml -directive: -# Support automatically generating code for key credentials. -- from: swagger-document - where: $.securityDefinitions - transform: | - $["AzureKey"] = $["apim_key"]; - delete $["apim_key"]; - -- from: analyzeconversations.json - where: $.security - transform: | - $ = [ - { - "AzureKey": [] - } - ]; - -- from: analyzeconversations-authoring.json - where: $.security - transform: | - $ = []; - -# Fix Endpoint parameter description and format. -- from: swagger-document - where: $.parameters.Endpoint - transform: | - $["description"] = "Supported Cognitive Services endpoint (e.g., https://.cognitiveservices.azure.com)."; - $["format"] = "url"; - -# Define multilingual parameter as a boolean. -- where-operation: ConversationalAnalysisAuthoring_GetSupportedPrebuiltEntities - transform: | - var multilingualParam = $.parameters.find(param => param.name === "multilingual"); - multilingualParam.type = "boolean"; - -# Define HTTP 200 responses for LROs to document result model. -- where-operation: AnalyzeConversation_SubmitJob - transform: | - $.responses["200"] = { - description: "Analysis job status and metadata.", - schema: { - "$ref": "#/definitions/AnalyzeConversationJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_DeleteProject - transform: | - $.responses["200"] = { - description: "The project deletion job result.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringProjectDeletionJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_Export - transform: | - $.responses["200"] = { - description: "The status of the long running operation.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringExportProjectJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_Import - transform: | - $.responses["200"] = { - description: "The details of the long running operation.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringImportProjectJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_Train - transform: | - $.responses["200"] = { - description: "The training job result.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringTrainingJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_SwapDeployments - transform: | - $.responses["200"] = { - description: "The swap deployment job result.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringDeploymentJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_DeployProject - transform: | - $.responses["200"] = { - description: "The deployment job result.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringProjectDeployment" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_DeleteDeployment - transform: | - $.responses["200"] = { - description: "The deployment job result.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringDeploymentJobState" - } - }; - -- where-operation: ConversationalAnalysisAuthoring_CancelTrainingJob - transform: | - $.responses["200"] = { - description: "The training job result.", - schema: { - "$ref": "#/definitions/ConversationalAnalysisAuthoringTrainingJobState" - } - }; - -# Move the stringIndexType parameter to just before the newly append trainedModelLabel for all operations referencing it. -- where-operation: ConversationalAnalysisAuthoring_Export - transform: | - var stringIndexTypeParamIndex = $.parameters.findIndex(param => param["$ref"] === "#/parameters/ConversationalAnalysisAuthoringStringIndexTypeQueryParameter"); - var stringIndexTypeParam = $.parameters[stringIndexTypeParamIndex]; - $.parameters.splice(stringIndexTypeParamIndex, 1); - - var apiVersionParamIndex = $.parameters.findIndex(param => param["$ref"] === "common.json#/parameters/ApiVersionParameter"); - var apiVersionParam = $.parameters[apiVersionParamIndex]; - $.parameters.splice(apiVersionParamIndex, 1); - - var trainedModelLabelIndex = $.parameters.findIndex(param => param.name === "trainedModelLabel"); - $.parameters.splice(trainedModelLabelIndex, 0, stringIndexTypeParam); - $.parameters.push(apiVersionParam); - -# Update descriptions to include a link to the REST API documentation. -- from: analyzeconversations.json - where: $.paths.*.* - transform: | - var version = $doc.info.version; - var operationId = $.operationId.substring($.operationId.indexOf("_") + 1); - $["externalDocs"] = { - url: "https://learn.microsoft.com/rest/api/language/" + version + "/conversation-analysis-runtime/" + operationId.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase() - }; - -- from: analyzeconversations.json - where-operation-match: /AnalyzeConversation_/ - transform: | - var version = $doc.info.version; - var operationId = $.operationId.substring($.operationId.indexOf("_") + 1); - $["externalDocs"] = { - url: "https://learn.microsoft.com/rest/api/language/" + version + "/analyze-conversation/" + operationId.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase() - }; - -- from: analyzeconversations-authoring.json - where: $.paths.*.* - transform: | - var version = $doc.info.version; - var operationId = $.operationId.substring($.operationId.indexOf("_") + 1); - $["externalDocs"] = { - url: "https://learn.microsoft.com/rest/api/language/" + version + "/conversational-analysis-authoring/" + operationId.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase() - }; - -# Rename operations to be consistent. Do this after other operation transforms for ease. -- rename-operation: - from: AnalyzeConversation_SubmitJob - to: ConversationAnalysis_AnalyzeConversations - -- rename-operation: - from: AnalyzeConversation_JobStatus - to: ConversationAnalysis_GetAnalyzeConversationJobStatus - -- rename-operation: - from: AnalyzeConversation_CancelJob - to: ConversationAnalysis_CancelAnalyzeConversations - -- rename-operation: - from: ConversationalAnalysisAuthoring_Export - to: ConversationalAnalysisAuthoring_ExportProject - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetDeploymentStatus - to: ConversationalAnalysisAuthoring_GetDeploymentJobStatus - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetExportStatus - to: ConversationalAnalysisAuthoring_GetExportProjectJobStatus - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetImportStatus - to: ConversationalAnalysisAuthoring_GetImportProjectJobStatus - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetProjectDeletionStatus - to: ConversationalAnalysisAuthoring_GetProjectDeletionJobStatus - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetSwapDeploymentsStatus - to: ConversationalAnalysisAuthoring_GetSwapDeploymentsJobStatus - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetTrainingStatus - to: ConversationalAnalysisAuthoring_GetTrainingJobStatus - -- rename-operation: - from: ConversationalAnalysisAuthoring_Import - to: ConversationalAnalysisAuthoring_ImportProject - -- rename-operation: - from: ConversationalAnalysisAuthoring_GetLoadSnapshotStatus - to: ConversationalAnalysisAuthoring_GetLoadSnapshotJobStatus -``` - -### C# customizations - -``` yaml -directive: -# Always default to UTF16 string indices. -- from: swagger-document - where: $.definitions.StringIndexType - transform: | - $["description"] = "Specifies the method used to interpret string offsets. Set this to \"Utf16CodeUnit\" for .NET strings, which are encoded as UTF-16."; - $["x-ms-client-default"] = "Utf16CodeUnit"; - -- from: swagger-document - where: $.definitions.ConversationalAnalysisAuthoringStringIndexType - transform: | - $["description"] = "Specifies the method used to interpret string offsets. Set this to \"Utf16CodeUnit\" for .NET strings, which are encoded as UTF-16."; - $["x-ms-client-default"] = "Utf16CodeUnit"; - -- from: swagger-document - where: $.parameters.ConversationalAnalysisAuthoringStringIndexTypeQueryParameter - transform: | - $["description"] = "Specifies the method used to interpret string offsets. Set this to \"Utf16CodeUnit\" for .NET strings, which are encoded as UTF-16."; - $["x-ms-client-default"] = "Utf16CodeUnit"; - -# Remove explicit paging parameters until Azure/azure-sdk-for-net#29342 is resolved. -# where-operation-match (Azure/autorest#4565) and remove-parameter (Azure/autorest#4566) do not work correctly. -- from: swagger-document - where: $.paths.*.* - transform: | - var paramRefs = [ - "common.json#/parameters/TopParameter", - "common.json#/parameters/SkipParameter", - "common.json#/parameters/MaxPageSizeParameter" - ]; - if (/ConversationalAnalysisAuthoring_((List(Projects|Deployments|TrainedModels|TrainingJobs|TrainingConfigVersions))|Get(ModelEvaluationResults|SupportedLanguages|SupportedPrebuiltEntities))/.test($.operationId)) { - $.parameters = $.parameters.filter(param => !paramRefs.includes(param["$ref"])); - } -``` diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs index 78cab70736e1c..bd24082f97387 100644 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAnalysisClient.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; +using Azure.AI.Language.Conversations.Models; using Azure.Core; using Azure.Identity; using NUnit.Framework; @@ -19,20 +20,22 @@ public partial class Samples_ConversationAnalysisClient { [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversation_ShortVersion() + public void Example_Conversations_AnalyzeConversation_ShortVersion() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new { id = "", participantId = "", + text = "", }, }, parameters = new @@ -40,7 +43,6 @@ public void Example_AnalyzeConversation_ShortVersion() projectName = "", deploymentName = "", }, - kind = "Conversation", }); Response response = client.AnalyzeConversation(content); @@ -50,20 +52,22 @@ public void Example_AnalyzeConversation_ShortVersion() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversation_ShortVersion_Async() + public async Task Example_Conversations_AnalyzeConversation_ShortVersion_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new { id = "", participantId = "", + text = "", }, }, parameters = new @@ -71,7 +75,6 @@ public async Task Example_AnalyzeConversation_ShortVersion_Async() projectName = "", deploymentName = "", }, - kind = "Conversation", }); Response response = await client.AnalyzeConversationAsync(content); @@ -81,14 +84,37 @@ public async Task Example_AnalyzeConversation_ShortVersion_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversation_AllParameters() + public void Example_Conversations_AnalyzeConversation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeConversation(AnalyzeConversationInputKind.Conversation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync(AnalyzeConversationInputKind.Conversation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversation_AllParameters() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new @@ -97,7 +123,8 @@ public void Example_AnalyzeConversation_AllParameters() participantId = "", language = "", modality = "transcript", - role = "agent", + role = "customer", + text = "", }, }, parameters = new @@ -106,28 +133,27 @@ public void Example_AnalyzeConversation_AllParameters() deploymentName = "", verbose = true, isLoggingEnabled = true, - stringIndexType = "Utf16CodeUnit", + stringIndexType = "TextElements_v8", directTarget = "", targetProjectParameters = new { key = new { + targetProjectKind = "Luis", query = "", callingOptions = new Dictionary { ["verbose"] = true, ["log"] = true, ["show-all-intents"] = true, - ["timezoneOffset"] = 123.45F, + ["timezoneOffset"] = 1234, ["spellCheck"] = true, ["bing-spell-check-subscription-key"] = "" }, - targetProjectKind = "Luis", apiVersion = "", }, }, }, - kind = "Conversation", }); Response response = client.AnalyzeConversation(content); @@ -137,14 +163,15 @@ public void Example_AnalyzeConversation_AllParameters() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversation_AllParameters_Async() + public async Task Example_Conversations_AnalyzeConversation_AllParameters_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + kind = "Conversation", analysisInput = new { conversationItem = new @@ -153,7 +180,8 @@ public async Task Example_AnalyzeConversation_AllParameters_Async() participantId = "", language = "", modality = "transcript", - role = "agent", + role = "customer", + text = "", }, }, parameters = new @@ -162,28 +190,27 @@ public async Task Example_AnalyzeConversation_AllParameters_Async() deploymentName = "", verbose = true, isLoggingEnabled = true, - stringIndexType = "Utf16CodeUnit", + stringIndexType = "TextElements_v8", directTarget = "", targetProjectParameters = new { key = new { + targetProjectKind = "Luis", query = "", callingOptions = new Dictionary { ["verbose"] = true, ["log"] = true, ["show-all-intents"] = true, - ["timezoneOffset"] = 123.45F, + ["timezoneOffset"] = 1234, ["spellCheck"] = true, ["bing-spell-check-subscription-key"] = "" }, - targetProjectKind = "Luis", apiVersion = "", }, }, }, - kind = "Conversation", }); Response response = await client.AnalyzeConversationAsync(content); @@ -193,72 +220,101 @@ public async Task Example_AnalyzeConversation_AllParameters_Async() [Test] [Ignore("Only validating compilation of examples")] - public void Example_GetAnalyzeConversationJobStatus_ShortVersion() + public void Example_Conversations_AnalyzeConversation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeConversation(AnalyzeConversationInputKind.Conversation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync(AnalyzeConversationInputKind.Conversation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_ShortVersion() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - 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()); 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_GetAnalyzeConversationJobStatus_ShortVersion_Async() + public async Task Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_ShortVersion_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - 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()); 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_GetAnalyzeConversationJobStatus_AllParameters() + public void Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_ShortVersion_Convenience() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Response response = client.GetAnalyzeConversationJobStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); + Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - 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()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); Console.WriteLine(result.GetProperty("displayName").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); @@ -268,46 +324,39 @@ public void Example_GetAnalyzeConversationJobStatus_AllParameters() Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("nextLink").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetAnalyzeConversationJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - - Response response = await client.GetAnalyzeConversationJobStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; 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()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("displayName").ToString()); Console.WriteLine(result.GetProperty("createdDateTime").ToString()); Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); @@ -317,25 +366,55 @@ public async Task Example_GetAnalyzeConversationJobStatus_AllParameters_Async() Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); Console.WriteLine(result.GetProperty("nextLink").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()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeConversationOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeConversationJobState_AnalyzeConversationOperationStatus_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeConversationOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversations_ShortVersion() + public void Example_Conversations_AnalyzeConversationSubmitOperation_ShortVersion() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -347,18 +426,18 @@ public void Example_AnalyzeConversations_ShortVersion() { new { +modality = "text", conversationItems = new object[] { new { -text = "", id = "", participantId = "", +text = "", } }, id = "", language = "", -modality = "text", } }, }, @@ -366,29 +445,18 @@ public void Example_AnalyzeConversations_ShortVersion() { new { -kind = "ConversationalSummarizationTask", +kind = "ConversationalPIITask", } }, }); - Operation operation = client.AnalyzeConversations(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - 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()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversations_ShortVersion_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_ShortVersion_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -400,18 +468,18 @@ public async Task Example_AnalyzeConversations_ShortVersion_Async() { new { +modality = "text", conversationItems = new object[] { new { -text = "", id = "", participantId = "", +text = "", } }, id = "", language = "", -modality = "text", } }, }, @@ -419,29 +487,60 @@ public async Task Example_AnalyzeConversations_ShortVersion_Async() { new { -kind = "ConversationalSummarizationTask", +kind = "ConversationalPIITask", } }, }); - Operation operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); + } - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - 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()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] + { +new TextConversation("", "", new TextConversationItem[] +{ +new TextConversationItem("", "", "") +}) + }); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] + { +new PiiOperationAction() + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] + { +new TextConversation("", "", new TextConversationItem[] +{ +new TextConversationItem("", "", "") +}) + }); + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] + { +new PiiOperationAction() + }); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_AnalyzeConversations_AllParameters() + public void Example_Conversations_AnalyzeConversationSubmitOperation_AllParameters() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -454,21 +553,21 @@ public void Example_AnalyzeConversations_AllParameters() { new { +modality = "text", conversationItems = new object[] { new { -text = "", id = "", participantId = "", language = "", modality = "transcript", -role = "agent", +role = "customer", +text = "", } }, id = "", language = "", -modality = "text", domain = "finance", } }, @@ -477,69 +576,35 @@ public void Example_AnalyzeConversations_AllParameters() { new { +kind = "ConversationalPIITask", parameters = new { -summaryAspects = new object[] +loggingOptOut = true, +modelVersion = "", +piiCategories = new object[] { -"issue" +"Address" +}, +redactAudioTiming = true, +redactionSource = "lexical", +redactionCharacter = "!", +excludePiiCategories = new object[] +{ +"Address" }, -sentenceCount = 1234, -stringIndexType = "Utf16CodeUnit", -modelVersion = "", -loggingOptOut = true, }, -kind = "ConversationalSummarizationTask", taskName = "", } }, }); - Operation operation = client.AnalyzeConversations(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - 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()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); - Console.WriteLine(result.GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("nextLink").ToString()); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, content); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AnalyzeConversations_AllParameters_Async() + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_AllParameters_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); @@ -552,21 +617,21 @@ public async Task Example_AnalyzeConversations_AllParameters_Async() { new { +modality = "text", conversationItems = new object[] { new { -text = "", id = "", participantId = "", language = "", modality = "transcript", -role = "agent", +role = "customer", +text = "", } }, id = "", language = "", -modality = "text", domain = "finance", } }, @@ -575,106 +640,156 @@ public async Task Example_AnalyzeConversations_AllParameters_Async() { new { +kind = "ConversationalPIITask", parameters = new { -summaryAspects = new object[] +loggingOptOut = true, +modelVersion = "", +piiCategories = new object[] { -"issue" +"Address" +}, +redactAudioTiming = true, +redactionSource = "lexical", +redactionCharacter = "!", +excludePiiCategories = new object[] +{ +"Address" }, -sentenceCount = 1234, -stringIndexType = "Utf16CodeUnit", -modelVersion = "", -loggingOptOut = true, }, -kind = "ConversationalSummarizationTask", taskName = "", } }, }); - Operation operation = await client.AnalyzeConversationsAsync(WaitUntil.Completed, content); - BinaryData responseData = operation.Value; + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, content); + } - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - 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()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); - Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("conversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousConversationsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); - Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); - Console.WriteLine(result.GetProperty("displayName").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("nextLink").ToString()); + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversations_AnalyzeConversationSubmitOperation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] + { +new TextConversation("", "", new TextConversationItem[] +{ +new TextConversationItem("", "", "") +{ +Language = "", +Modality = InputModality.Transcript, +Role = ParticipantRole.Customer, +} +}) +{ +Domain = ConversationDomain.Finance, +} + }); + Operation operation = client.AnalyzeConversationSubmitOperation(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new ConversationPiiActionContent +{ +LoggingOptOut = true, +ModelVersion = "", +PiiCategories = {ConversationPiiCategories.Address}, +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +RedactionCharacter = RedactionCharacter.ExclamationPoint, +ExcludePiiCategories = {ConversationPiiCategoryExclusions.Address}, +}, +Name = "", +} + }, displayName: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversations_AnalyzeConversationSubmitOperation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); + + MultiLanguageConversationInput conversationInput = new MultiLanguageConversationInput(new ConversationInput[] + { +new TextConversation("", "", new TextConversationItem[] +{ +new TextConversationItem("", "", "") +{ +Language = "", +Modality = InputModality.Transcript, +Role = ParticipantRole.Customer, +} +}) +{ +Domain = ConversationDomain.Finance, +} + }); + Operation operation = await client.AnalyzeConversationSubmitOperationAsync(WaitUntil.Completed, conversationInput, new AnalyzeConversationOperationAction[] + { +new PiiOperationAction +{ +ActionContent = new ConversationPiiActionContent +{ +LoggingOptOut = true, +ModelVersion = "", +PiiCategories = {ConversationPiiCategories.Address}, +RedactAudioTiming = true, +RedactionSource = TranscriptContentType.Lexical, +RedactionCharacter = RedactionCharacter.ExclamationPoint, +ExcludePiiCategories = {ConversationPiiCategoryExclusions.Address}, +}, +Name = "", +} + }, displayName: ""); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CancelAnalyzeConversations_ShortVersion() + public void Example_Conversations_AnalyzeConversationCancelOperation_ShortVersion() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Operation operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Operation operation = client.AnalyzeConversationCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CancelAnalyzeConversations_ShortVersion_Async() + public async Task Example_Conversations_AnalyzeConversationCancelOperation_ShortVersion_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Operation operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Operation operation = await client.AnalyzeConversationCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_CancelAnalyzeConversations_AllParameters() + public void Example_Conversations_AnalyzeConversationCancelOperation_AllParameters() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Operation operation = client.CancelAnalyzeConversations(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Operation operation = client.AnalyzeConversationCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_CancelAnalyzeConversations_AllParameters_Async() + public async Task Example_Conversations_AnalyzeConversationCancelOperation_AllParameters_Async() { - Uri endpoint = new Uri(""); + Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); ConversationAnalysisClient client = new ConversationAnalysisClient(endpoint, credential); - Operation operation = await client.CancelAnalyzeConversationsAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + Operation operation = await client.AnalyzeConversationCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); } } } diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAuthoringClient.cs b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAuthoringClient.cs deleted file mode 100644 index 2d54ff8e82d55..0000000000000 --- a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tests/Generated/Samples/Samples_ConversationAuthoringClient.cs +++ /dev/null @@ -1,3256 +0,0 @@ -// 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.AI.Language.Conversations.Authoring; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.AI.Language.Conversations.Samples -{ - public partial class Samples_ConversationAuthoringClient - { - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateProject_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectKind = "Conversation", - projectName = "", - language = "", - }); - Response response = client.CreateProject("", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectKind = "Conversation", - projectName = "", - language = "", - }); - Response response = await client.CreateProjectAsync("", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CreateProject_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", - }); - Response response = client.CreateProject("", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CreateProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", - }); - Response response = await client.CreateProjectAsync("", content); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetProject_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetProject(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetProjectAsync(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetProject_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetProject(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetProjectAsync(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetDeployment_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetDeployment("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployment_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetDeploymentAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetDeployment_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetDeployment("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployment_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetDeploymentAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetDeploymentJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetDeploymentJobStatus("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeploymentJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetDeploymentJobStatusAsync("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetDeploymentJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetDeploymentJobStatus("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeploymentJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetDeploymentJobStatusAsync("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetSwapDeploymentsJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetSwapDeploymentsJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetSwapDeploymentsJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetSwapDeploymentsJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetSwapDeploymentsJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetSwapDeploymentsJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetSwapDeploymentsJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetSwapDeploymentsJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetExportProjectJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetExportProjectJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetExportProjectJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetExportProjectJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetExportProjectJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetExportProjectJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("resultUrl").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetExportProjectJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetExportProjectJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("resultUrl").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetImportProjectJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetImportProjectJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetImportProjectJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetImportProjectJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetImportProjectJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetImportProjectJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetImportProjectJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetImportProjectJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainedModel_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetTrainedModel("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainedModel_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetTrainedModelAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainedModel_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetTrainedModel("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainedModel_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetTrainedModelAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteTrainedModel_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.DeleteTrainedModel("", ""); - - Console.WriteLine(response.Status); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteTrainedModel_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.DeleteTrainedModelAsync("", ""); - - Console.WriteLine(response.Status); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteTrainedModel_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.DeleteTrainedModel("", ""); - - Console.WriteLine(response.Status); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteTrainedModel_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.DeleteTrainedModelAsync("", ""); - - Console.WriteLine(response.Status); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetModelEvaluationSummary_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetModelEvaluationSummary("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetModelEvaluationSummary_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetModelEvaluationSummaryAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetModelEvaluationSummary_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetModelEvaluationSummary("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); - Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("trainingSplitPercentage").ToString()); - Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("testingSplitPercentage").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetModelEvaluationSummary_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetModelEvaluationSummaryAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("entities").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("entitiesEvaluation").GetProperty("macroRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("normalizedValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("confusionMatrix").GetProperty("").GetProperty("").GetProperty("rawValue").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("f1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("precision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("recall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("truePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("trueNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falsePositiveCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("intents").GetProperty("").GetProperty("falseNegativeCount").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("microRecall").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroF1").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroPrecision").ToString()); - Console.WriteLine(result.GetProperty("intentsEvaluation").GetProperty("macroRecall").ToString()); - Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("kind").ToString()); - Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("trainingSplitPercentage").ToString()); - Console.WriteLine(result.GetProperty("evaluationOptions").GetProperty("testingSplitPercentage").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetLoadSnapshotJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetLoadSnapshotJobStatus("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetLoadSnapshotJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetLoadSnapshotJobStatusAsync("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetLoadSnapshotJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetLoadSnapshotJobStatus("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetLoadSnapshotJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetLoadSnapshotJobStatusAsync("", "", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetTrainingJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetTrainingJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetTrainingJobStatus("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetTrainingJobStatusAsync("", ""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetProjectDeletionJobStatus_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetProjectDeletionJobStatus(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetProjectDeletionJobStatus_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetProjectDeletionJobStatusAsync(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetProjectDeletionJobStatus_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = client.GetProjectDeletionJobStatus(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetProjectDeletionJobStatus_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Response response = await client.GetProjectDeletionJobStatusAsync(""); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetProjects_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetProjects()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetProjects_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetProjectsAsync()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetProjects_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetProjects()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetProjects_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetProjectsAsync()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastModifiedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("projectKind").ToString()); - Console.WriteLine(result.GetProperty("settings").GetProperty("confidenceThreshold").ToString()); - Console.WriteLine(result.GetProperty("projectName").ToString()); - Console.WriteLine(result.GetProperty("multilingual").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetDeployments_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetDeployments("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployments_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetDeploymentsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetDeployments_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetDeployments("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetDeployments_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetDeploymentsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainedModels_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetTrainedModels("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainedModels_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetTrainedModelsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainedModels_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetTrainedModels("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainedModels_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetTrainedModelsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("label").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastTrainingDurationInSeconds").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("hasSnapshot").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetModelEvaluationResults_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetModelEvaluationResults("", "")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetModelEvaluationResults_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetModelEvaluationResultsAsync("", "")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetModelEvaluationResults_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetModelEvaluationResults("", "", stringIndexType: "Utf16CodeUnit")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetModelEvaluationResults_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetModelEvaluationResultsAsync("", "", stringIndexType: "Utf16CodeUnit")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("text").ToString()); - Console.WriteLine(result.GetProperty("language").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("expectedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("offset").ToString()); - Console.WriteLine(result.GetProperty("entitiesResult").GetProperty("predictedEntities")[0].GetProperty("length").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("expectedIntent").ToString()); - Console.WriteLine(result.GetProperty("intentsResult").GetProperty("predictedIntent").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingJobs_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetTrainingJobs("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingJobs_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetTrainingJobsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingJobs_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetTrainingJobs("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingJobs_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetTrainingJobsAsync("")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetSupportedLanguages_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetSupportedLanguages("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetSupportedLanguages_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetSupportedLanguagesAsync("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetSupportedLanguages_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetSupportedLanguages("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetSupportedLanguages_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetSupportedLanguagesAsync("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("languageName").ToString()); - Console.WriteLine(result.GetProperty("languageCode").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetSupportedPrebuiltEntities_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetSupportedPrebuiltEntities()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetSupportedPrebuiltEntities_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetSupportedPrebuiltEntitiesAsync()) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetSupportedPrebuiltEntities_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetSupportedPrebuiltEntities(language: "", multilingual: true)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetSupportedPrebuiltEntities_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetSupportedPrebuiltEntitiesAsync(language: "", multilingual: true)) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("category").ToString()); - Console.WriteLine(result.GetProperty("description").ToString()); - Console.WriteLine(result.GetProperty("examples").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingConfigVersions_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetTrainingConfigVersions("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingConfigVersions_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_GetTrainingConfigVersions_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - foreach (BinaryData item in client.GetTrainingConfigVersions("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_GetTrainingConfigVersions_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - await foreach (BinaryData item in client.GetTrainingConfigVersionsAsync("Conversation")) - { - JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("modelExpirationDate").ToString()); - } - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteProject_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.DeleteProject(WaitUntil.Completed, ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.DeleteProjectAsync(WaitUntil.Completed, ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteProject_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.DeleteProject(WaitUntil.Completed, ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.DeleteProjectAsync(WaitUntil.Completed, ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_ExportProject_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.ExportProject(WaitUntil.Completed, ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_ExportProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.ExportProjectAsync(WaitUntil.Completed, ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_ExportProject_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.ExportProject(WaitUntil.Completed, "", exportedProjectFormat: "Conversation", assetKind: "", stringIndexType: "Utf16CodeUnit", trainedModelLabel: ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("resultUrl").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_ExportProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.ExportProjectAsync(WaitUntil.Completed, "", exportedProjectFormat: "Conversation", assetKind: "", stringIndexType: "Utf16CodeUnit", trainedModelLabel: ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("resultUrl").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_ImportProject_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - projectName = "", - language = "", - }, - }); - Operation operation = client.ImportProject(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_ImportProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - projectName = "", - language = "", - }, - }); - Operation operation = await client.ImportProjectAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_ImportProject_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", - }, - assets = new - { - intents = new object[] - { -new -{ -category = "", -} - }, - entities = new object[] - { -new -{ -category = "", -compositionSetting = "returnLongestOverlap", -list = new -{ -sublists = new object[] -{ -new -{ -listKey = "", -synonyms = new object[] -{ -new -{ -language = "", -values = new object[] -{ -"" -}, -} -}, -} -}, -}, -prebuilts = new object[] -{ -new -{ -category = "", -} -}, -regex = new -{ -expressions = new object[] -{ -new -{ -regexKey = "", -language = "", -regexPattern = "", -} -}, -}, -requiredComponents = new object[] -{ -"" -}, -} - }, - utterances = new object[] - { -new -{ -entities = new object[] -{ -new -{ -category = "", -offset = 1234, -length = 1234, -} -}, -text = "", -language = "", -intent = "", -dataset = "", -} - }, - projectKind = "Conversation", - }, - }); - Operation operation = client.ImportProject(WaitUntil.Completed, "", content, exportedProjectFormat: "Conversation"); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_ImportProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - projectFileVersion = "", - stringIndexType = "Utf16CodeUnit", - metadata = new - { - projectKind = "Conversation", - settings = new - { - confidenceThreshold = 123.45F, - }, - projectName = "", - multilingual = true, - description = "", - language = "", - }, - assets = new - { - intents = new object[] - { -new -{ -category = "", -} - }, - entities = new object[] - { -new -{ -category = "", -compositionSetting = "returnLongestOverlap", -list = new -{ -sublists = new object[] -{ -new -{ -listKey = "", -synonyms = new object[] -{ -new -{ -language = "", -values = new object[] -{ -"" -}, -} -}, -} -}, -}, -prebuilts = new object[] -{ -new -{ -category = "", -} -}, -regex = new -{ -expressions = new object[] -{ -new -{ -regexKey = "", -language = "", -regexPattern = "", -} -}, -}, -requiredComponents = new object[] -{ -"" -}, -} - }, - utterances = new object[] - { -new -{ -entities = new object[] -{ -new -{ -category = "", -offset = 1234, -length = 1234, -} -}, -text = "", -language = "", -intent = "", -dataset = "", -} - }, - projectKind = "Conversation", - }, - }); - Operation operation = await client.ImportProjectAsync(WaitUntil.Completed, "", content, exportedProjectFormat: "Conversation"); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Train_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - trainingMode = "advanced", - }); - Operation operation = client.Train(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_Train_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - trainingMode = "advanced", - }); - Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_Train_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - trainingConfigVersion = "", - trainingMode = "advanced", - evaluationOptions = new - { - kind = "percentage", - trainingSplitPercentage = 1234, - testingSplitPercentage = 1234, - }, - }); - Operation operation = client.Train(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_Train_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - modelLabel = "", - trainingConfigVersion = "", - trainingMode = "advanced", - evaluationOptions = new - { - kind = "percentage", - trainingSplitPercentage = 1234, - testingSplitPercentage = 1234, - }, - }); - Operation operation = await client.TrainAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_SwapDeployments_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_SwapDeployments_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_SwapDeployments_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Operation operation = client.SwapDeployments(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_SwapDeployments_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - firstDeploymentName = "", - secondDeploymentName = "", - }); - Operation operation = await client.SwapDeploymentsAsync(WaitUntil.Completed, "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeployProject_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - trainedModelLabel = "", - }); - Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeployProject_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - trainedModelLabel = "", - }); - Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeployProject_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - trainedModelLabel = "", - }); - Operation operation = client.DeployProject(WaitUntil.Completed, "", "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeployProject_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - using RequestContent content = RequestContent.Create(new - { - trainedModelLabel = "", - }); - Operation operation = await client.DeployProjectAsync(WaitUntil.Completed, "", "", content); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("deploymentName").ToString()); - Console.WriteLine(result.GetProperty("modelId").ToString()); - Console.WriteLine(result.GetProperty("lastTrainedDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastDeployedDateTime").ToString()); - Console.WriteLine(result.GetProperty("deploymentExpirationDate").ToString()); - Console.WriteLine(result.GetProperty("modelTrainingConfigVersion").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteDeployment_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteDeployment_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_DeleteDeployment_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.DeleteDeployment(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_DeleteDeployment_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.DeleteDeploymentAsync(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LoadSnapshot_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.LoadSnapshot(WaitUntil.Completed, "", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LoadSnapshot_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.LoadSnapshotAsync(WaitUntil.Completed, "", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LoadSnapshot_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.LoadSnapshot(WaitUntil.Completed, "", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LoadSnapshot_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.LoadSnapshotAsync(WaitUntil.Completed, "", ""); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CancelTrainingJob_ShortVersion() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.CancelTrainingJob(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CancelTrainingJob_ShortVersion_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.CancelTrainingJobAsync(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_CancelTrainingJob_AllParameters() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = client.CancelTrainingJob(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_CancelTrainingJob_AllParameters_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - ConversationAuthoringClient client = new ConversationAuthoringClient(endpoint, credential); - - Operation operation = await client.CancelTrainingJobAsync(WaitUntil.Completed, "", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("result").GetProperty("modelLabel").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingConfigVersion").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingMode").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("trainingStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("startDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("endDateTime").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("evaluationStatus").GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("result").GetProperty("estimatedEndDateTime").ToString()); - Console.WriteLine(result.GetProperty("jobId").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); - Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("warnings")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("details")[0].GetProperty("innererror").GetProperty("target").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); - Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); - } - } -} diff --git a/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml new file mode 100644 index 0000000000000..4d079b824379c --- /dev/null +++ b/sdk/cognitivelanguage/Azure.AI.Language.Conversations/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/cognitiveservices/Language.Conversations +commit: 75f41e873ea0ca7adca9f4b4a9e2e60b9388a27a +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln new file mode 100644 index 0000000000000..34a2ae3085f28 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Azure.AI.Language.Text.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Language.Text", "src\Azure.AI.Language.Text.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.AI.Language.Text.Tests", "tests\Azure.AI.Language.Text.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md new file mode 100644 index 0000000000000..13dd08af78abe --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props new file mode 100644 index 0000000000000..63bd836ad44b7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md new file mode 100644 index 0000000000000..889fdb32d2559 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/README.md @@ -0,0 +1,107 @@ +# Azure.AI.Language.Text client library for .NET + +Azure.AI.Language.Text is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/textanalytics/Azure.AI.Language.Text/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.AI.Language.Text --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +### Service API versions + +The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version. + +For example, + +```C# Snippet:CreateClientForSpecificApiVersion +Uri endpoint = new Uri(""); +DefaultAzureCredential credential = new DefaultAzureCredential(); +ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.) +var client = new Client(endpoint, credential, options); +``` + +When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/textanalytics/Azure.AI.Language.Text/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/textanalytics/Azure.AI.Language.Text/README.png) diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs new file mode 100644 index 0000000000000..266303008371c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/api/Azure.AI.Language.Text.netstandard2.0.cs @@ -0,0 +1,3332 @@ +namespace Azure.AI.Language.Text +{ + public partial class TextAnalysisClient + { + protected TextAnalysisClient() { } + public TextAnalysisClient(System.Uri endpoint, Azure.AzureKeyCredential credential) { } + public TextAnalysisClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.AI.Language.Text.TextAnalysisClientOptions options) { } + public TextAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public TextAnalysisClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.AI.Language.Text.TextAnalysisClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response AnalyzeText(Azure.AI.Language.Text.Models.AnalyzeTextInput analyzeTextInput, bool? showStatistics = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response AnalyzeText(Azure.Core.RequestContent content, bool? showStatistics = default(bool?), Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> AnalyzeTextAsync(Azure.AI.Language.Text.Models.AnalyzeTextInput analyzeTextInput, bool? showStatistics = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextAsync(Azure.Core.RequestContent content, bool? showStatistics = default(bool?), Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation AnalyzeTextCancelOperation(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextCancelOperationAsync(Azure.WaitUntil waitUntil, System.Guid jobId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response AnalyzeTextOperationStatus(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual Azure.Response AnalyzeTextOperationStatus(System.Guid jobId, bool? showStats = default(bool?), int? top = default(int?), int? skip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextOperationStatusAsync(System.Guid jobId, bool? showStats, int? top, int? skip, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> AnalyzeTextOperationStatusAsync(System.Guid jobId, bool? showStats = default(bool?), int? top = default(int?), int? skip = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation AnalyzeTextSubmitOperation(Azure.WaitUntil waitUntil, Azure.AI.Language.Text.Models.MultiLanguageTextInput textInput, System.Collections.Generic.IEnumerable actions, string displayName = null, string defaultLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Operation AnalyzeTextSubmitOperation(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.AI.Language.Text.Models.MultiLanguageTextInput textInput, System.Collections.Generic.IEnumerable actions, string displayName = null, string defaultLanguage = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AnalyzeTextSubmitOperationAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + } + public partial class TextAnalysisClientOptions : Azure.Core.ClientOptions + { + public TextAnalysisClientOptions(Azure.AI.Language.Text.TextAnalysisClientOptions.ServiceVersion version = Azure.AI.Language.Text.TextAnalysisClientOptions.ServiceVersion.V2023_11_15_Preview) { } + public enum ServiceVersion + { + V2022_05_01 = 1, + V2023_04_01 = 2, + V2023_11_15_Preview = 3, + } + } +} +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public int? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.SummaryLengthBucket? SummaryLength { get { throw null; } set { } } + Azure.AI.Language.Text.Models.AbstractiveSummarizationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AbstractiveSummarizationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummarizationOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AbstractiveSummarizationOperationAction() { } + public Azure.AI.Language.Text.Models.AbstractiveSummarizationActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.AbstractiveSummarizationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AbstractiveSummarizationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummarizationOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.AbstractiveSummarizationResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AbstractiveSummarizationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AbstractiveSummarizationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummarizationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummarizationResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.AbstractiveSummarizationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AbstractiveSummarizationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummary : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummary() { } + public System.Collections.Generic.IReadOnlyList Contexts { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.AbstractiveSummary System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AbstractiveSummary System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AbstractiveSummaryDocumentResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AbstractiveSummaryDocumentResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Summaries { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.AbstractiveSummaryDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AbstractiveSummaryDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AgeMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AgeMetadata() { } + public Azure.AI.Language.Text.Models.AgeUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.AgeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AgeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AgeUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AgeUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.AgeUnit Day { get { throw null; } } + public static Azure.AI.Language.Text.Models.AgeUnit Month { get { throw null; } } + public static Azure.AI.Language.Text.Models.AgeUnit Unspecified { get { throw null; } } + public static Azure.AI.Language.Text.Models.AgeUnit Week { get { throw null; } } + public static Azure.AI.Language.Text.Models.AgeUnit Year { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.AgeUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.AgeUnit left, Azure.AI.Language.Text.Models.AgeUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.AgeUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.AgeUnit left, Azure.AI.Language.Text.Models.AgeUnit right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class AILanguageTextModelFactory + { + public static Azure.AI.Language.Text.Models.AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.AbstractiveSummarizationResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AbstractiveSummarizationResult AbstractiveSummarizationResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.AbstractiveSummary AbstractiveSummary(string text = null, System.Collections.Generic.IEnumerable contexts = null) { throw null; } + public static Azure.AI.Language.Text.Models.AbstractiveSummaryDocumentResultWithDetectedLanguage AbstractiveSummaryDocumentResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable summaries = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.AgeMetadata AgeMetadata(double value = 0, Azure.AI.Language.Text.Models.AgeUnit unit = default(Azure.AI.Language.Text.Models.AgeUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextDynamicClassificationResult AnalyzeTextDynamicClassificationResult(Azure.AI.Language.Text.Models.DynamicClassificationResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextEntitiesResult AnalyzeTextEntitiesResult(Azure.AI.Language.Text.Models.EntitiesResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextEntityLinkingResult AnalyzeTextEntityLinkingResult(Azure.AI.Language.Text.Models.EntityLinkingResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextError AnalyzeTextError(Azure.AI.Language.Text.Models.AnalyzeTextErrorCode code = default(Azure.AI.Language.Text.Models.AnalyzeTextErrorCode), string message = null, string target = null, System.Collections.Generic.IEnumerable details = null, Azure.AI.Language.Text.Models.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextKeyPhraseResult AnalyzeTextKeyPhraseResult(Azure.AI.Language.Text.Models.KeyPhraseResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextLanguageDetectionResult AnalyzeTextLanguageDetectionResult(Azure.AI.Language.Text.Models.LanguageDetectionResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextOperationResult AnalyzeTextOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, string kind = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextOperationState AnalyzeTextOperationState(string displayName = null, System.DateTimeOffset createdAt = default(System.DateTimeOffset), System.DateTimeOffset? expiresOn = default(System.DateTimeOffset?), System.Guid jobId = default(System.Guid), System.DateTimeOffset lastUpdatedAt = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), System.Collections.Generic.IEnumerable errors = null, string nextLink = null, Azure.AI.Language.Text.Models.TextActions actions = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextPiiResult AnalyzeTextPiiResult(Azure.AI.Language.Text.Models.PiiResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextSentimentResult AnalyzeTextSentimentResult(Azure.AI.Language.Text.Models.SentimentResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.AreaMetadata AreaMetadata(double value = 0, Azure.AI.Language.Text.Models.AreaUnit unit = default(Azure.AI.Language.Text.Models.AreaUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.ClassificationDocumentResultWithDetectedLanguage ClassificationDocumentResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable @class = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.ClassificationResult ClassificationResult(string category = null, double confidenceScore = 0) { throw null; } + public static Azure.AI.Language.Text.Models.CurrencyMetadata CurrencyMetadata(double value = 0, string unit = null, string iso4217 = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationActionContent CustomAbstractiveSummarizationActionContent(int? sentenceCount = default(int?), Azure.AI.Language.Text.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.Models.StringIndexType?), Azure.AI.Language.Text.Models.SummaryLengthBucket? summaryLength = default(Azure.AI.Language.Text.Models.SummaryLengthBucket?), bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationOperationAction CustomAbstractiveSummarizationOperationAction(string name = null, Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationActionContent actionContent = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationOperationResult CustomAbstractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationResult CustomAbstractiveSummarizationResult(System.Collections.Generic.IEnumerable documents = null, System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomEntitiesActionContent CustomEntitiesActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null, Azure.AI.Language.Text.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.Models.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Text.Models.CustomEntitiesResultWithDocumentDetectedLanguage CustomEntitiesResultWithDocumentDetectedLanguage(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomEntityRecognitionOperationResult CustomEntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.CustomEntitiesResultWithDocumentDetectedLanguage results = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomHealthcareActionContent CustomHealthcareActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null, Azure.AI.Language.Text.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.Models.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Text.Models.CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, System.Collections.Generic.IEnumerable relations = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomHealthcareEntity CustomHealthcareEntity(string text = null, Azure.AI.Language.Text.Models.HealthcareEntityCategory category = default(Azure.AI.Language.Text.Models.HealthcareEntityCategory), string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, Azure.AI.Language.Text.Models.HealthcareAssertion assertion = null, string name = null, System.Collections.Generic.IEnumerable links = null, System.Collections.Generic.IEnumerable entityComponentInformation = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomHealthcareOperationResult CustomHealthcareOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.CustomHealthcareResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomHealthcareResult CustomHealthcareResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage CustomLabelClassificationResultWithDocumentDetectedLanguage(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomMultiLabelClassificationActionContent CustomMultiLabelClassificationActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomMultiLabelClassificationOperationResult CustomMultiLabelClassificationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage results = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSentenceSentiment CustomSentenceSentiment(string text = null, Azure.AI.Language.Text.Models.SentenceSentimentValue sentiment = Azure.AI.Language.Text.Models.SentenceSentimentValue.Positive, Azure.AI.Language.Text.Models.SentimentConfidenceScores confidenceScores = null, int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSentimentAnalysisActionContent CustomSentimentAnalysisActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null, Azure.AI.Language.Text.Models.StringIndexType? stringIndexType = default(Azure.AI.Language.Text.Models.StringIndexType?)) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSentimentAnalysisOperationResult CustomSentimentAnalysisOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.CustomSentimentAnalysisResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSentimentAnalysisResult CustomSentimentAnalysisResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string projectName = null, string deploymentName = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSentimentAnalysisResultDocument CustomSentimentAnalysisResultDocument(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, Azure.AI.Language.Text.Models.DocumentSentiment sentiment = Azure.AI.Language.Text.Models.DocumentSentiment.Positive, Azure.AI.Language.Text.Models.SentimentConfidenceScores confidenceScores = null, System.Collections.Generic.IEnumerable sentences = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSingleLabelClassificationActionContent CustomSingleLabelClassificationActionContent(bool? loggingOptOut = default(bool?), string projectName = null, string deploymentName = null) { throw null; } + public static Azure.AI.Language.Text.Models.CustomSingleLabelClassificationOperationResult CustomSingleLabelClassificationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage results = null) { throw null; } + public static Azure.AI.Language.Text.Models.DateMetadata DateMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.Models.DateTimeMetadata DateTimeMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.Models.DateValue DateValue(string timex = null, string value = null, Azure.AI.Language.Text.Models.TemporalModifier? modifier = default(Azure.AI.Language.Text.Models.TemporalModifier?)) { throw null; } + public static Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage(string name = null, string iso6391Name = null, double confidenceScore = 0, Azure.AI.Language.Text.Models.ScriptKind? script = default(Azure.AI.Language.Text.Models.ScriptKind?), Azure.AI.Language.Text.Models.ScriptCode? scriptCode = default(Azure.AI.Language.Text.Models.ScriptCode?)) { throw null; } + public static Azure.AI.Language.Text.Models.DocumentError DocumentError(string id = null, Azure.AI.Language.Text.Models.AnalyzeTextError error = null) { throw null; } + public static Azure.AI.Language.Text.Models.DocumentStatistics DocumentStatistics(int charactersCount = 0, int transactionsCount = 0) { throw null; } + public static Azure.AI.Language.Text.Models.DocumentWarning DocumentWarning(Azure.AI.Language.Text.Models.WarningCode code = default(Azure.AI.Language.Text.Models.WarningCode), string message = null, string targetRef = null) { throw null; } + public static Azure.AI.Language.Text.Models.DynamicClassificationDocumentResult DynamicClassificationDocumentResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable classifications = null) { throw null; } + public static Azure.AI.Language.Text.Models.DynamicClassificationResult DynamicClassificationResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntitiesDocumentResultWithDetectedLanguage EntitiesDocumentResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntitiesDocumentResultWithMetadataDetectedLanguage EntitiesDocumentResultWithMetadataDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntitiesResult EntitiesResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntityLinkingMatch EntityLinkingMatch(double confidenceScore = 0, string text = null, int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.Models.EntityLinkingOperationResult EntityLinkingOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.EntityLinkingResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntityLinkingResult EntityLinkingResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntityLinkingResultWithDetectedLanguage EntityLinkingResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntityRecognitionOperationResult EntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.EntitiesResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.EntityTag EntityTag(string name = null, double? confidenceScore = default(double?)) { throw null; } + public static Azure.AI.Language.Text.Models.ExtractedSummaryDocumentResultWithDetectedLanguage ExtractedSummaryDocumentResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable sentences = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.ExtractedSummarySentence ExtractedSummarySentence(string text = null, double rankScore = 0, int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.Models.ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.ExtractiveSummarizationResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.ExtractiveSummarizationResult ExtractiveSummarizationResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.FhirBundle FhirBundle(System.Collections.Generic.IReadOnlyDictionary additionalProperties = null) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareAssertion HealthcareAssertion(Azure.AI.Language.Text.Models.HealthcareAssertionConditionality? conditionality = default(Azure.AI.Language.Text.Models.HealthcareAssertionConditionality?), Azure.AI.Language.Text.Models.HealthcareAssertionCertainty? certainty = default(Azure.AI.Language.Text.Models.HealthcareAssertionCertainty?), Azure.AI.Language.Text.Models.HealthcareAssertionAssociation? association = default(Azure.AI.Language.Text.Models.HealthcareAssertionAssociation?), Azure.AI.Language.Text.Models.HealthcareAssertionTemporality? temporality = default(Azure.AI.Language.Text.Models.HealthcareAssertionTemporality?)) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable entities = null, System.Collections.Generic.IEnumerable relations = null, Azure.AI.Language.Text.Models.FhirBundle fhirBundle = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareEntity HealthcareEntity(string text = null, Azure.AI.Language.Text.Models.HealthcareEntityCategory category = default(Azure.AI.Language.Text.Models.HealthcareEntityCategory), string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, Azure.AI.Language.Text.Models.HealthcareAssertion assertion = null, string name = null, System.Collections.Generic.IEnumerable links = null) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareEntityLink HealthcareEntityLink(string dataSource = null, string id = null) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareOperationResult HealthcareOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.HealthcareResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareRelation HealthcareRelation(Azure.AI.Language.Text.Models.RelationType relationType = default(Azure.AI.Language.Text.Models.RelationType), System.Collections.Generic.IEnumerable entities = null, double? confidenceScore = default(double?)) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareRelationEntity HealthcareRelationEntity(string @ref = null, string role = null) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareResult HealthcareResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.InformationMetadata InformationMetadata(double value = 0, Azure.AI.Language.Text.Models.InformationUnit unit = default(Azure.AI.Language.Text.Models.InformationUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.InnerErrorModel InnerErrorModel(Azure.AI.Language.Text.Models.InnerErrorCode code = default(Azure.AI.Language.Text.Models.InnerErrorCode), string message = null, System.Collections.Generic.IReadOnlyDictionary details = null, string target = null, Azure.AI.Language.Text.Models.InnerErrorModel innererror = null) { throw null; } + public static Azure.AI.Language.Text.Models.KeyPhraseExtractionOperationResult KeyPhraseExtractionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.KeyPhraseResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.KeyPhraseResult KeyPhraseResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.KeyPhrasesDocumentResultWithDetectedLanguage KeyPhrasesDocumentResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, System.Collections.Generic.IEnumerable keyPhrases = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.LanguageDetectionDocumentResult LanguageDetectionDocumentResult(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.LanguageDetectionResult LanguageDetectionResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.LanguageInput LanguageInput(string id = null, string text = null, string countryHint = null) { throw null; } + public static Azure.AI.Language.Text.Models.LearnedComponent LearnedComponent(string value = null) { throw null; } + public static Azure.AI.Language.Text.Models.LengthMetadata LengthMetadata(double value = 0, Azure.AI.Language.Text.Models.LengthUnit unit = default(Azure.AI.Language.Text.Models.LengthUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.LinkedEntity LinkedEntity(string name = null, System.Collections.Generic.IEnumerable matches = null, string language = null, string id = null, string url = null, string dataSource = null, string bingId = null) { throw null; } + public static Azure.AI.Language.Text.Models.ListComponent ListComponent(string value = null) { throw null; } + public static Azure.AI.Language.Text.Models.MultiLanguageInput MultiLanguageInput(string id = null, string text = null, string language = null) { throw null; } + public static Azure.AI.Language.Text.Models.NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0) { throw null; } + public static Azure.AI.Language.Text.Models.NamedEntityWithMetadata NamedEntityWithMetadata(string text = null, string category = null, string subcategory = null, int offset = 0, int length = 0, double confidenceScore = 0, string type = null, System.Collections.Generic.IEnumerable tags = null, Azure.AI.Language.Text.Models.BaseMetadata metadata = null) { throw null; } + public static Azure.AI.Language.Text.Models.NumberMetadata NumberMetadata(Azure.AI.Language.Text.Models.NumberKind numberKind = default(Azure.AI.Language.Text.Models.NumberKind), double value = 0) { throw null; } + public static Azure.AI.Language.Text.Models.NumericRangeMetadata NumericRangeMetadata(Azure.AI.Language.Text.Models.RangeKind rangeKind = default(Azure.AI.Language.Text.Models.RangeKind), double minimum = 0, double maximum = 0, Azure.AI.Language.Text.Models.RangeInclusivity? rangeInclusivity = default(Azure.AI.Language.Text.Models.RangeInclusivity?)) { throw null; } + public static Azure.AI.Language.Text.Models.OrdinalMetadata OrdinalMetadata(string offset = null, Azure.AI.Language.Text.Models.RelativeTo relativeTo = default(Azure.AI.Language.Text.Models.RelativeTo), string value = null) { throw null; } + public static Azure.AI.Language.Text.Models.PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.PiiResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.PiiResult PiiResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.PiiResultWithDetectedLanguage PiiResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, string redactedText = null, System.Collections.Generic.IEnumerable entities = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.PrebuiltComponent PrebuiltComponent(string value = null) { throw null; } + public static Azure.AI.Language.Text.Models.RequestStatistics RequestStatistics(int documentsCount = 0, int validDocumentsCount = 0, int erroneousDocumentsCount = 0, long transactionsCount = (long)0) { throw null; } + public static Azure.AI.Language.Text.Models.SentenceAssessment SentenceAssessment(Azure.AI.Language.Text.Models.TokenSentiment sentiment = Azure.AI.Language.Text.Models.TokenSentiment.Positive, Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel confidenceScores = null, int offset = 0, int length = 0, string text = null, bool isNegated = false) { throw null; } + public static Azure.AI.Language.Text.Models.SentenceSentiment SentenceSentiment(string text = null, Azure.AI.Language.Text.Models.SentenceSentimentValue sentiment = Azure.AI.Language.Text.Models.SentenceSentimentValue.Positive, Azure.AI.Language.Text.Models.SentimentConfidenceScores confidenceScores = null, int offset = 0, int length = 0, System.Collections.Generic.IEnumerable targets = null, System.Collections.Generic.IEnumerable assessments = null) { throw null; } + public static Azure.AI.Language.Text.Models.SentenceTarget SentenceTarget(Azure.AI.Language.Text.Models.TokenSentiment sentiment = Azure.AI.Language.Text.Models.TokenSentiment.Positive, Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel confidenceScores = null, int offset = 0, int length = 0, string text = null, System.Collections.Generic.IEnumerable relations = null) { throw null; } + public static Azure.AI.Language.Text.Models.SentimentConfidenceScores SentimentConfidenceScores(double positive = 0, double neutral = 0, double negative = 0) { throw null; } + public static Azure.AI.Language.Text.Models.SentimentDocumentResultWithDetectedLanguage SentimentDocumentResultWithDetectedLanguage(string id = null, System.Collections.Generic.IEnumerable warnings = null, Azure.AI.Language.Text.Models.DocumentStatistics statistics = null, Azure.AI.Language.Text.Models.DocumentSentiment sentiment = Azure.AI.Language.Text.Models.DocumentSentiment.Positive, Azure.AI.Language.Text.Models.SentimentConfidenceScores confidenceScores = null, System.Collections.Generic.IEnumerable sentences = null, Azure.AI.Language.Text.Models.DetectedLanguage detectedLanguage = null) { throw null; } + public static Azure.AI.Language.Text.Models.SentimentOperationResult SentimentOperationResult(System.DateTimeOffset lastUpdateDateTime = default(System.DateTimeOffset), Azure.AI.Language.Text.Models.TextActionState status = default(Azure.AI.Language.Text.Models.TextActionState), string name = null, Azure.AI.Language.Text.Models.SentimentResult results = null) { throw null; } + public static Azure.AI.Language.Text.Models.SentimentResult SentimentResult(System.Collections.Generic.IEnumerable errors = null, Azure.AI.Language.Text.Models.RequestStatistics statistics = null, string modelVersion = null, System.Collections.Generic.IEnumerable documents = null) { throw null; } + public static Azure.AI.Language.Text.Models.SpeedMetadata SpeedMetadata(double value = 0, Azure.AI.Language.Text.Models.SpeedUnit unit = default(Azure.AI.Language.Text.Models.SpeedUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.SummaryContext SummaryContext(int offset = 0, int length = 0) { throw null; } + public static Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel TargetConfidenceScoreLabel(double positive = 0, double negative = 0) { throw null; } + public static Azure.AI.Language.Text.Models.TargetRelation TargetRelation(string @ref = null, Azure.AI.Language.Text.Models.TargetRelationType relationType = Azure.AI.Language.Text.Models.TargetRelationType.Assessment) { throw null; } + public static Azure.AI.Language.Text.Models.TemperatureMetadata TemperatureMetadata(double value = 0, Azure.AI.Language.Text.Models.TemperatureUnit unit = default(Azure.AI.Language.Text.Models.TemperatureUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.TemporalSetMetadata TemporalSetMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.Models.TemporalSpanMetadata TemporalSpanMetadata(System.Collections.Generic.IEnumerable spanValues = null) { throw null; } + public static Azure.AI.Language.Text.Models.TemporalSpanValues TemporalSpanValues(string begin = null, string end = null, string duration = null, Azure.AI.Language.Text.Models.TemporalModifier? modifier = default(Azure.AI.Language.Text.Models.TemporalModifier?), string timex = null) { throw null; } + public static Azure.AI.Language.Text.Models.TextActions TextActions(int completed = 0, int failed = 0, int inProgress = 0, int total = 0, System.Collections.Generic.IEnumerable items = null) { throw null; } + public static Azure.AI.Language.Text.Models.TimeMetadata TimeMetadata(System.Collections.Generic.IEnumerable dates = null) { throw null; } + public static Azure.AI.Language.Text.Models.VolumeMetadata VolumeMetadata(double value = 0, Azure.AI.Language.Text.Models.VolumeUnit unit = default(Azure.AI.Language.Text.Models.VolumeUnit)) { throw null; } + public static Azure.AI.Language.Text.Models.WeightMetadata WeightMetadata(double value = 0, Azure.AI.Language.Text.Models.WeightUnit unit = default(Azure.AI.Language.Text.Models.WeightUnit)) { throw null; } + } + public partial class AllowOverlapEntityPolicyType : Azure.AI.Language.Text.Models.EntityOverlapPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AllowOverlapEntityPolicyType() { } + Azure.AI.Language.Text.Models.AllowOverlapEntityPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AllowOverlapEntityPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextDynamicClassificationResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextDynamicClassificationResult() { } + public Azure.AI.Language.Text.Models.DynamicClassificationResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextDynamicClassificationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextDynamicClassificationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextEntitiesResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextEntitiesResult() { } + public Azure.AI.Language.Text.Models.EntitiesResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextEntitiesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextEntitiesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextEntityLinkingResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextEntityLinkingResult() { } + public Azure.AI.Language.Text.Models.EntityLinkingResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextEntityLinkingResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextEntityLinkingResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextError() { } + public Azure.AI.Language.Text.Models.AnalyzeTextErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Details { get { throw null; } } + public Azure.AI.Language.Text.Models.InnerErrorModel Innererror { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AnalyzeTextErrorCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AnalyzeTextErrorCode(string value) { throw null; } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode AzureCognitiveSearchIndexLimitReached { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode AzureCognitiveSearchIndexNotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode Conflict { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode Forbidden { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode InternalServerError { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode InvalidArgument { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode NotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode OperationNotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode ProjectNotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode QuotaExceeded { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode ServiceUnavailable { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode Timeout { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode TooManyRequests { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode Unauthorized { get { throw null; } } + public static Azure.AI.Language.Text.Models.AnalyzeTextErrorCode Warning { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.AnalyzeTextErrorCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.AnalyzeTextErrorCode left, Azure.AI.Language.Text.Models.AnalyzeTextErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.AnalyzeTextErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.AnalyzeTextErrorCode left, Azure.AI.Language.Text.Models.AnalyzeTextErrorCode right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class AnalyzeTextInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextInput() { } + Azure.AI.Language.Text.Models.AnalyzeTextInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextKeyPhraseResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextKeyPhraseResult() { } + public Azure.AI.Language.Text.Models.KeyPhraseResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextKeyPhraseResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextKeyPhraseResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextLanguageDetectionResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextLanguageDetectionResult() { } + public Azure.AI.Language.Text.Models.LanguageDetectionResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextLanguageDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextLanguageDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class AnalyzeTextOperationAction : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextOperationAction() { } + public string Name { get { throw null; } set { } } + Azure.AI.Language.Text.Models.AnalyzeTextOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class AnalyzeTextOperationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextOperationResult(System.DateTimeOffset lastUpdateDateTime, Azure.AI.Language.Text.Models.TextActionState status) { } + public System.DateTimeOffset LastUpdateDateTime { get { throw null; } } + public string Name { get { throw null; } } + public Azure.AI.Language.Text.Models.TextActionState Status { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextOperationState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextOperationState() { } + public Azure.AI.Language.Text.Models.TextActions Actions { get { throw null; } } + public System.DateTimeOffset CreatedAt { get { throw null; } } + public string DisplayName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public System.DateTimeOffset? ExpiresOn { get { throw null; } } + public System.Guid JobId { get { throw null; } } + public System.DateTimeOffset LastUpdatedAt { get { throw null; } } + public string NextLink { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + public Azure.AI.Language.Text.Models.TextActionState Status { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextOperationState System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextOperationState System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextPiiResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextPiiResult() { } + public Azure.AI.Language.Text.Models.PiiResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextPiiResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextPiiResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class AnalyzeTextResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected AnalyzeTextResult() { } + Azure.AI.Language.Text.Models.AnalyzeTextResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AnalyzeTextSentimentResult : Azure.AI.Language.Text.Models.AnalyzeTextResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AnalyzeTextSentimentResult() { } + public Azure.AI.Language.Text.Models.SentimentResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.AnalyzeTextSentimentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AnalyzeTextSentimentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class AreaMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AreaMetadata() { } + public Azure.AI.Language.Text.Models.AreaUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.AreaMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.AreaMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AreaUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AreaUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.AreaUnit Acre { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareCentimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareDecameter { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareDecimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareFoot { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareHectometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareInch { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareKilometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareMeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareMile { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareMillimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit SquareYard { get { throw null; } } + public static Azure.AI.Language.Text.Models.AreaUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.AreaUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.AreaUnit left, Azure.AI.Language.Text.Models.AreaUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.AreaUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.AreaUnit left, Azure.AI.Language.Text.Models.AreaUnit right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class BaseMetadata : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected BaseMetadata() { } + Azure.AI.Language.Text.Models.BaseMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.BaseMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ClassificationDocumentResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ClassificationDocumentResultWithDetectedLanguage() { } + public System.Collections.Generic.IReadOnlyList Class { get { throw null; } } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.ClassificationDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ClassificationDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ClassificationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ClassificationResult() { } + public string Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + Azure.AI.Language.Text.Models.ClassificationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ClassificationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ClassificationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ClassificationType(string value) { throw null; } + public static Azure.AI.Language.Text.Models.ClassificationType Multi { get { throw null; } } + public static Azure.AI.Language.Text.Models.ClassificationType Single { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.ClassificationType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.ClassificationType left, Azure.AI.Language.Text.Models.ClassificationType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.ClassificationType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.ClassificationType left, Azure.AI.Language.Text.Models.ClassificationType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CurrencyMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CurrencyMetadata() { } + public string Iso4217 { get { throw null; } } + public string Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.CurrencyMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CurrencyMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomAbstractiveSummarizationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public int? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.SummaryLengthBucket? SummaryLength { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomAbstractiveSummarizationOperationAction(Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationActionContent actionContent) { } + public Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationActionContent ActionContent { get { throw null; } } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomAbstractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomAbstractiveSummarizationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomAbstractiveSummarizationResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomAbstractiveSummarizationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntitiesActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomEntitiesActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomEntitiesActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomEntitiesActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntitiesOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomEntitiesOperationAction() { } + public Azure.AI.Language.Text.Models.CustomEntitiesActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomEntitiesOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomEntitiesOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntitiesResultWithDocumentDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomEntitiesResultWithDocumentDetectedLanguage() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.CustomEntitiesResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomEntitiesResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomEntityRecognitionOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomEntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.CustomEntitiesResultWithDocumentDetectedLanguage Results { get { throw null; } } + Azure.AI.Language.Text.Models.CustomEntityRecognitionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomEntityRecognitionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomHealthcareActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomHealthcareActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomHealthcareActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Relations { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareEntity() { } + public Azure.AI.Language.Text.Models.HealthcareAssertion Assertion { get { throw null; } } + public Azure.AI.Language.Text.Models.HealthcareEntityCategory Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public System.Collections.Generic.IReadOnlyList EntityComponentInformation { get { throw null; } } + public int Length { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } + public string Name { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.CustomHealthcareEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomHealthcareEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomHealthcareOperationAction() { } + public Azure.AI.Language.Text.Models.CustomHealthcareActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomHealthcareOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomHealthcareOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.CustomHealthcareResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.CustomHealthcareOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomHealthcareOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomHealthcareResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomHealthcareResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.CustomHealthcareResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomHealthcareResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomLabelClassificationResultWithDocumentDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomLabelClassificationResultWithDocumentDetectedLanguage() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomMultiLabelClassificationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomMultiLabelClassificationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + Azure.AI.Language.Text.Models.CustomMultiLabelClassificationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomMultiLabelClassificationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomMultiLabelClassificationOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomMultiLabelClassificationOperationAction() { } + public Azure.AI.Language.Text.Models.CustomMultiLabelClassificationActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomMultiLabelClassificationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomMultiLabelClassificationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomMultiLabelClassificationOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomMultiLabelClassificationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage Results { get { throw null; } } + Azure.AI.Language.Text.Models.CustomMultiLabelClassificationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomMultiLabelClassificationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentenceSentiment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentenceSentiment() { } + public Azure.AI.Language.Text.Models.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public Azure.AI.Language.Text.Models.SentenceSentimentValue Sentiment { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.CustomSentenceSentiment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSentenceSentiment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSentimentAnalysisActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSentimentAnalysisOperationAction() { } + public Azure.AI.Language.Text.Models.CustomSentimentAnalysisActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentimentAnalysisOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.CustomSentimentAnalysisResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentimentAnalysisResult() { } + public string DeploymentName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ProjectName { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSentimentAnalysisResultDocument : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSentimentAnalysisResultDocument() { } + public Azure.AI.Language.Text.Models.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sentences { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentSentiment Sentiment { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisResultDocument System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSentimentAnalysisResultDocument System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSingleLabelClassificationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSingleLabelClassificationActionContent(string projectName, string deploymentName) { } + public string DeploymentName { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ProjectName { get { throw null; } } + Azure.AI.Language.Text.Models.CustomSingleLabelClassificationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSingleLabelClassificationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSingleLabelClassificationOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomSingleLabelClassificationOperationAction() { } + public Azure.AI.Language.Text.Models.CustomSingleLabelClassificationActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.CustomSingleLabelClassificationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSingleLabelClassificationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class CustomSingleLabelClassificationOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CustomSingleLabelClassificationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.CustomLabelClassificationResultWithDocumentDetectedLanguage Results { get { throw null; } } + Azure.AI.Language.Text.Models.CustomSingleLabelClassificationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.CustomSingleLabelClassificationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DateMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DateMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + Azure.AI.Language.Text.Models.DateMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DateMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DateTimeMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DateTimeMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + Azure.AI.Language.Text.Models.DateTimeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DateTimeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DateValue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DateValue() { } + public Azure.AI.Language.Text.Models.TemporalModifier? Modifier { get { throw null; } } + public string Timex { get { throw null; } } + public string Value { get { throw null; } } + Azure.AI.Language.Text.Models.DateValue System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DateValue System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DetectedLanguage() { } + public double ConfidenceScore { get { throw null; } } + public string Iso6391Name { get { throw null; } } + public string Name { get { throw null; } } + public Azure.AI.Language.Text.Models.ScriptKind? Script { get { throw null; } } + public Azure.AI.Language.Text.Models.ScriptCode? ScriptCode { get { throw null; } } + Azure.AI.Language.Text.Models.DetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DocumentError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentError() { } + public Azure.AI.Language.Text.Models.AnalyzeTextError Error { get { throw null; } } + public string Id { get { throw null; } } + Azure.AI.Language.Text.Models.DocumentError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DocumentError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum DocumentSentiment + { + Positive = 0, + Neutral = 1, + Negative = 2, + Mixed = 3, + } + public partial class DocumentStatistics : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentStatistics() { } + public int CharactersCount { get { throw null; } } + public int TransactionsCount { get { throw null; } } + Azure.AI.Language.Text.Models.DocumentStatistics System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DocumentStatistics System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DocumentWarning : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DocumentWarning() { } + public Azure.AI.Language.Text.Models.WarningCode Code { get { throw null; } } + public string Message { get { throw null; } } + public string TargetRef { get { throw null; } } + Azure.AI.Language.Text.Models.DocumentWarning System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DocumentWarning System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DynamicClassificationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DynamicClassificationActionContent(System.Collections.Generic.IEnumerable categories) { } + public System.Collections.Generic.IList Categories { get { throw null; } } + public Azure.AI.Language.Text.Models.ClassificationType? ClassificationType { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + Azure.AI.Language.Text.Models.DynamicClassificationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DynamicClassificationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DynamicClassificationDocumentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DynamicClassificationDocumentResult() { } + public System.Collections.Generic.IReadOnlyList Classifications { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.DynamicClassificationDocumentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DynamicClassificationDocumentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DynamicClassificationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DynamicClassificationResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.DynamicClassificationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.DynamicClassificationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntitiesActionContent() { } + public System.Collections.Generic.IList Exclusions { get { throw null; } } + public System.Collections.Generic.IList Inclusions { get { throw null; } } + public Azure.AI.Language.Text.Models.EntityInferenceConfig InferenceOptions { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.EntityOverlapPolicy OverlapPolicy { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.EntitiesActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntitiesActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesDocumentResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntitiesDocumentResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.EntitiesDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntitiesDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesDocumentResultWithMetadataDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntitiesDocumentResultWithMetadataDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.EntitiesDocumentResultWithMetadataDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntitiesDocumentResultWithMetadataDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntitiesOperationAction() { } + public Azure.AI.Language.Text.Models.EntitiesActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.EntitiesOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntitiesOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntitiesResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntitiesResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.EntitiesResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntitiesResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EntityCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EntityCategory(string value) { throw null; } + public static Azure.AI.Language.Text.Models.EntityCategory Address { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Age { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Airport { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Area { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory City { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory ComputingProduct { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Continent { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory CountryRegion { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory CulturalEvent { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Currency { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Date { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory DateRange { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory DateTime { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory DateTimeRange { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Dimension { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Duration { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Email { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Event { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Geological { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory GeoPoliticalEntity { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Height { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Information { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory IpAddress { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Length { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Location { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory NaturalEvent { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Number { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory NumberRange { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Numeric { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Ordinal { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Organization { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory OrganizationMedical { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory OrganizationSports { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory OrganizationStockExchange { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Percentage { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Person { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory PersonType { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Product { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory SetTemporal { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Skill { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Speed { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory SportsEvent { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory State { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Structural { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Temperature { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Temporal { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Time { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory TimeRange { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Uri { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Volume { get { throw null; } } + public static Azure.AI.Language.Text.Models.EntityCategory Weight { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.EntityCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.EntityCategory left, Azure.AI.Language.Text.Models.EntityCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.EntityCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.EntityCategory left, Azure.AI.Language.Text.Models.EntityCategory right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class EntityComponentInformation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected EntityComponentInformation() { } + Azure.AI.Language.Text.Models.EntityComponentInformation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityComponentInformation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityInferenceConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityInferenceConfig() { } + public bool? ExcludeNormalizedValues { get { throw null; } set { } } + Azure.AI.Language.Text.Models.EntityInferenceConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityInferenceConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityLinkingActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.EntityLinkingActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityLinkingActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingMatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingMatch() { } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.EntityLinkingMatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityLinkingMatch System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EntityLinkingOperationAction() { } + public Azure.AI.Language.Text.Models.EntityLinkingActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.EntityLinkingOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityLinkingOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.EntityLinkingResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.EntityLinkingOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityLinkingOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.EntityLinkingResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityLinkingResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityLinkingResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityLinkingResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.EntityLinkingResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityLinkingResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public abstract partial class EntityOverlapPolicy : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected EntityOverlapPolicy() { } + Azure.AI.Language.Text.Models.EntityOverlapPolicy System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityOverlapPolicy System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityRecognitionOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.EntitiesResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.EntityRecognitionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityRecognitionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EntityTag : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal EntityTag() { } + public double? ConfidenceScore { get { throw null; } } + public string Name { get { throw null; } } + Azure.AI.Language.Text.Models.EntityTag System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.EntityTag System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractedSummaryDocumentResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractedSummaryDocumentResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sentences { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.ExtractedSummaryDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ExtractedSummaryDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractedSummarySentence : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractedSummarySentence() { } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public double RankScore { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.ExtractedSummarySentence System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ExtractedSummarySentence System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExtractiveSummarizationActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public string Query { get { throw null; } set { } } + public long? SentenceCount { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria? SortBy { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.ExtractiveSummarizationActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ExtractiveSummarizationActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExtractiveSummarizationOperationAction() { } + public Azure.AI.Language.Text.Models.ExtractiveSummarizationActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.ExtractiveSummarizationOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ExtractiveSummarizationOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractiveSummarizationOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.ExtractiveSummarizationResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.ExtractiveSummarizationOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ExtractiveSummarizationOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExtractiveSummarizationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ExtractiveSummarizationResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.ExtractiveSummarizationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ExtractiveSummarizationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExtractiveSummarizationSortingCriteria : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExtractiveSummarizationSortingCriteria(string value) { throw null; } + public static Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria Offset { get { throw null; } } + public static Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria Rank { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria left, Azure.AI.Language.Text.Models.ExtractiveSummarizationSortingCriteria right) { throw null; } + public override string ToString() { throw null; } + } + public partial class FhirBundle : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FhirBundle() { } + public System.Collections.Generic.IReadOnlyDictionary AdditionalProperties { get { throw null; } } + Azure.AI.Language.Text.Models.FhirBundle System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.FhirBundle System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FhirVersion : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FhirVersion(string value) { throw null; } + public static Azure.AI.Language.Text.Models.FhirVersion _401 { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.FhirVersion other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.FhirVersion left, Azure.AI.Language.Text.Models.FhirVersion right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.FhirVersion (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.FhirVersion left, Azure.AI.Language.Text.Models.FhirVersion right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HealthcareActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public HealthcareActionContent() { } + public Azure.AI.Language.Text.Models.HealthcareDocumentType? DocumentType { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.FhirVersion? FhirVersion { get { throw null; } set { } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.HealthcareActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareAssertion : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareAssertion() { } + public Azure.AI.Language.Text.Models.HealthcareAssertionAssociation? Association { get { throw null; } } + public Azure.AI.Language.Text.Models.HealthcareAssertionCertainty? Certainty { get { throw null; } } + public Azure.AI.Language.Text.Models.HealthcareAssertionConditionality? Conditionality { get { throw null; } } + public Azure.AI.Language.Text.Models.HealthcareAssertionTemporality? Temporality { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareAssertion System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareAssertion System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum HealthcareAssertionAssociation + { + Subject = 0, + Other = 1, + } + public enum HealthcareAssertionCertainty + { + Positive = 0, + PositivePossible = 1, + NeutralPossible = 2, + NegativePossible = 3, + Negative = 4, + } + public enum HealthcareAssertionConditionality + { + Hypothetical = 0, + Conditional = 1, + } + public enum HealthcareAssertionTemporality + { + Current = 0, + Past = 1, + Future = 2, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HealthcareDocumentType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HealthcareDocumentType(string value) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType ClinicalTrial { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType Consult { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType DischargeSummary { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType HistoryAndPhysical { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType Imaging { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType None { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType Pathology { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType ProcedureNote { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareDocumentType ProgressNote { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.HealthcareDocumentType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.HealthcareDocumentType left, Azure.AI.Language.Text.Models.HealthcareDocumentType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.HealthcareDocumentType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.HealthcareDocumentType left, Azure.AI.Language.Text.Models.HealthcareDocumentType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public Azure.AI.Language.Text.Models.FhirBundle FhirBundle { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Relations { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage 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 HealthcareEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareEntity() { } + public Azure.AI.Language.Text.Models.HealthcareAssertion Assertion { get { throw null; } } + public Azure.AI.Language.Text.Models.HealthcareEntityCategory Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } + public string Name { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HealthcareEntityCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HealthcareEntityCategory(string value) { throw null; } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory AdministrativeEvent { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Age { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Allergen { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory BodyStructure { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory CareEnvironment { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory ConditionQualifier { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory ConditionScale { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Course { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Date { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Diagnosis { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Direction { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Dosage { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Employment { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Ethnicity { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory ExaminationName { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Expression { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory FamilyRelation { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Frequency { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Gender { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory GeneOrProtein { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory HealthcareProfession { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory LivingStatus { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MeasurementUnit { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MeasurementValue { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MedicationClass { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MedicationForm { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MedicationName { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MedicationRoute { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory MutationType { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory RelationalOperator { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory SubstanceUse { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory SubstanceUseAmount { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory SymptomOrSign { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Time { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory TreatmentName { get { throw null; } } + public static Azure.AI.Language.Text.Models.HealthcareEntityCategory Variant { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.HealthcareEntityCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.HealthcareEntityCategory left, Azure.AI.Language.Text.Models.HealthcareEntityCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.HealthcareEntityCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.HealthcareEntityCategory left, Azure.AI.Language.Text.Models.HealthcareEntityCategory right) { throw null; } + public override string ToString() { throw null; } + } + public partial class HealthcareEntityLink : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareEntityLink() { } + public string DataSource { get { throw null; } } + public string Id { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareEntityLink System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareEntityLink System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public HealthcareOperationAction() { } + public Azure.AI.Language.Text.Models.HealthcareActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.HealthcareOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.HealthcareResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareRelation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareRelation() { } + public double? ConfidenceScore { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public Azure.AI.Language.Text.Models.RelationType RelationType { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareRelation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareRelation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareRelationEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareRelationEntity() { } + public string Ref { get { throw null; } } + public string Role { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareRelationEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareRelationEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class HealthcareResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthcareResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.HealthcareResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.HealthcareResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InformationMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal InformationMetadata() { } + public Azure.AI.Language.Text.Models.InformationUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.InformationMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.InformationMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct InformationUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public InformationUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.InformationUnit Bit { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Byte { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Gigabit { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Gigabyte { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Kilobit { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Kilobyte { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Megabit { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Megabyte { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Petabit { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Petabyte { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Terabit { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Terabyte { get { throw null; } } + public static Azure.AI.Language.Text.Models.InformationUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.InformationUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.InformationUnit left, Azure.AI.Language.Text.Models.InformationUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.InformationUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.InformationUnit left, Azure.AI.Language.Text.Models.InformationUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct InnerErrorCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public InnerErrorCode(string value) { throw null; } + public static Azure.AI.Language.Text.Models.InnerErrorCode AzureCognitiveSearchNotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode AzureCognitiveSearchThrottling { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode EmptyRequest { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode ExtractionFailure { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode InvalidCountryHint { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode InvalidDocument { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode InvalidDocumentBatch { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode InvalidParameterValue { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode InvalidRequest { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode InvalidRequestBodyFormat { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode KnowledgeBaseNotFound { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode MissingInputDocuments { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode ModelVersionIncorrect { get { throw null; } } + public static Azure.AI.Language.Text.Models.InnerErrorCode UnsupportedLanguageCode { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.InnerErrorCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.InnerErrorCode left, Azure.AI.Language.Text.Models.InnerErrorCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.InnerErrorCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.InnerErrorCode left, Azure.AI.Language.Text.Models.InnerErrorCode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class InnerErrorModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal InnerErrorModel() { } + public Azure.AI.Language.Text.Models.InnerErrorCode Code { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Details { get { throw null; } } + public Azure.AI.Language.Text.Models.InnerErrorModel Innererror { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + Azure.AI.Language.Text.Models.InnerErrorModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.InnerErrorModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyPhraseActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + Azure.AI.Language.Text.Models.KeyPhraseActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.KeyPhraseActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseExtractionOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal KeyPhraseExtractionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.KeyPhraseResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.KeyPhraseExtractionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.KeyPhraseExtractionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyPhraseOperationAction() { } + public Azure.AI.Language.Text.Models.KeyPhraseActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.KeyPhraseOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.KeyPhraseOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhraseResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal KeyPhraseResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.KeyPhraseResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.KeyPhraseResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyPhrasesDocumentResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal KeyPhrasesDocumentResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList KeyPhrases { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.KeyPhrasesDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.KeyPhrasesDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public LanguageDetectionActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + Azure.AI.Language.Text.Models.LanguageDetectionActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LanguageDetectionActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionDocumentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LanguageDetectionDocumentResult() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.LanguageDetectionDocumentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LanguageDetectionDocumentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LanguageDetectionResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.LanguageDetectionResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LanguageDetectionResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageDetectionTextInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public LanguageDetectionTextInput() { } + public System.Collections.Generic.IList Documents { get { throw null; } } + Azure.AI.Language.Text.Models.LanguageDetectionTextInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LanguageDetectionTextInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LanguageInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public LanguageInput(string id, string text) { } + public string CountryHint { get { throw null; } set { } } + public string Id { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.LanguageInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LanguageInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LearnedComponent : Azure.AI.Language.Text.Models.EntityComponentInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LearnedComponent() { } + public string Value { get { throw null; } } + Azure.AI.Language.Text.Models.LearnedComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LearnedComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class LengthMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LengthMetadata() { } + public Azure.AI.Language.Text.Models.LengthUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.LengthMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LengthMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LengthUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LengthUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.LengthUnit Centimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Decameter { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Decimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Foot { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Hectometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Inch { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Kilometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit LightYear { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Meter { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Micrometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Mile { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Millimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Nanometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Picometer { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Point { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Unspecified { get { throw null; } } + public static Azure.AI.Language.Text.Models.LengthUnit Yard { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.LengthUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.LengthUnit left, Azure.AI.Language.Text.Models.LengthUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.LengthUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.LengthUnit left, Azure.AI.Language.Text.Models.LengthUnit right) { throw null; } + public override string ToString() { throw null; } + } + public partial class LinkedEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal LinkedEntity() { } + public string BingId { get { throw null; } } + public string DataSource { get { throw null; } } + public string Id { get { throw null; } } + public string Language { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Matches { get { throw null; } } + public string Name { get { throw null; } } + public string Url { get { throw null; } } + Azure.AI.Language.Text.Models.LinkedEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.LinkedEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ListComponent : Azure.AI.Language.Text.Models.EntityComponentInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ListComponent() { } + public string Value { get { throw null; } } + Azure.AI.Language.Text.Models.ListComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.ListComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MatchLongestEntityPolicyType : Azure.AI.Language.Text.Models.EntityOverlapPolicy, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MatchLongestEntityPolicyType() { } + Azure.AI.Language.Text.Models.MatchLongestEntityPolicyType System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.MatchLongestEntityPolicyType System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MultiLanguageInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MultiLanguageInput(string id, string text) { } + public string Id { get { throw null; } } + public string Language { get { throw null; } set { } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.MultiLanguageInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.MultiLanguageInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class MultiLanguageTextInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MultiLanguageTextInput() { } + public System.Collections.Generic.IList Documents { get { throw null; } } + Azure.AI.Language.Text.Models.MultiLanguageTextInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.MultiLanguageTextInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NamedEntity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NamedEntity() { } + public string Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.NamedEntity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.NamedEntity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NamedEntityWithMetadata : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NamedEntityWithMetadata() { } + public string Category { get { throw null; } } + public double ConfidenceScore { get { throw null; } } + public int Length { get { throw null; } } + public Azure.AI.Language.Text.Models.BaseMetadata Metadata { get { throw null; } } + public int Offset { get { throw null; } } + public string Subcategory { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Tags { get { throw null; } } + public string Text { get { throw null; } } + public string Type { get { throw null; } } + Azure.AI.Language.Text.Models.NamedEntityWithMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.NamedEntityWithMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct NumberKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public NumberKind(string value) { throw null; } + public static Azure.AI.Language.Text.Models.NumberKind Decimal { get { throw null; } } + public static Azure.AI.Language.Text.Models.NumberKind Fraction { get { throw null; } } + public static Azure.AI.Language.Text.Models.NumberKind Integer { get { throw null; } } + public static Azure.AI.Language.Text.Models.NumberKind Percent { get { throw null; } } + public static Azure.AI.Language.Text.Models.NumberKind Power { get { throw null; } } + public static Azure.AI.Language.Text.Models.NumberKind Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.NumberKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.NumberKind left, Azure.AI.Language.Text.Models.NumberKind right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.NumberKind (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.NumberKind left, Azure.AI.Language.Text.Models.NumberKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class NumberMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NumberMetadata() { } + public Azure.AI.Language.Text.Models.NumberKind NumberKind { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.NumberMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.NumberMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class NumericRangeMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal NumericRangeMetadata() { } + public double Maximum { get { throw null; } } + public double Minimum { get { throw null; } } + public Azure.AI.Language.Text.Models.RangeInclusivity? RangeInclusivity { get { throw null; } } + public Azure.AI.Language.Text.Models.RangeKind RangeKind { get { throw null; } } + Azure.AI.Language.Text.Models.NumericRangeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.NumericRangeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OrdinalMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OrdinalMetadata() { } + public string Offset { get { throw null; } } + public Azure.AI.Language.Text.Models.RelativeTo RelativeTo { get { throw null; } } + public string Value { get { throw null; } } + Azure.AI.Language.Text.Models.OrdinalMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.OrdinalMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiActionContent() { } + public Azure.AI.Language.Text.Models.PiiDomain? Domain { get { throw null; } set { } } + public System.Collections.Generic.IList ExcludePiiCategories { get { throw null; } } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public System.Collections.Generic.IList PiiCategories { get { throw null; } } + public Azure.AI.Language.Text.Models.RedactionCharacter? RedactionCharacter { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.PiiActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.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.Text.Models.PiiCategoriesExclude AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude Address { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude Age { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureSas { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude Date { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude Email { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EsDni { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FiNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude IlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude IPAddress { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude Organization { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude Person { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SaNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SeNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude SwiftCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude TwNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude URL { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategoriesExclude ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.PiiCategoriesExclude other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.PiiCategoriesExclude left, Azure.AI.Language.Text.Models.PiiCategoriesExclude right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.PiiCategoriesExclude (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.PiiCategoriesExclude left, Azure.AI.Language.Text.Models.PiiCategoriesExclude right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PiiCategory : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PiiCategory(string value) { throw null; } + public static Azure.AI.Language.Text.Models.PiiCategory AbaRoutingNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Address { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Age { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory All { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ArNationalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AtIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AtValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuBusinessNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuCompanyNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuMedicalAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AuTaxFileNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureDocumentDbauthKey { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureIaasDatabaseConnectionAndSqlString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureIoTConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzurePublishSettingPassword { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureRedisCacheString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureSas { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureServiceBusString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureStorageAccountGeneric { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory AzureStorageAccountKey { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BeNationalNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BeNationalNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BeValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BgUniformCivilNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BrCpfNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BrLegalEntityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory BrNationalIdRg { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CaBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CaDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CaHealthServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CaPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CaPersonalHealthIdentification { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CaSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ChSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ClIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CnResidentIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CreditCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CyIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CyTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CzPersonalIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory CzPersonalIdentityV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Date { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DeDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Default { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DeIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DeValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DkPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DkPersonalIdentificationV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory DrugEnforcementAgencyNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EePersonalIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Email { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EsDni { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EsTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuDebitCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuGpsCoordinates { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory EuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FiEuropeanHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FiNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FiNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FiPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrHealthInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory FrValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory GrNationalIdCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory GrNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory GrTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HkIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HrIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HrNationalIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HrPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HrPersonalIdentificationOIBNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HuPersonalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HuTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory HuValueAddedNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory IdIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory IePersonalPublicServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory IePersonalPublicServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory IlBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory IlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory InPermanentAccount { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory InternationalBankingAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory InUniqueIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory IPAddress { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ItDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ItFiscalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ItValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpMyNumberCorporate { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpMyNumberPersonal { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpResidenceCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory JpSocialInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory KrResidentRegistrationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory LtPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory LuNationalIdentificationNumberNatural { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory LuNationalIdentificationNumberNonNatural { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory LvPersonalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory MtIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory MtTaxIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory MyIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NlCitizensServiceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NlCitizensServiceNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NlValueAddedTaxNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NoIdentityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NzBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NzDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NzInlandRevenueNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NzMinistryOfHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory NzSocialWelfareNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Organization { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory Person { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PhoneNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PhUnifiedMultiPurposeIdNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PlIdentityCard { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PlNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PlNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PlPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PlRegonNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PlTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PtCitizenCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PtCitizenCardNumberV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory PtTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory RoPersonalNumericalCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory RuPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory RuPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SaNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SeNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SeNationalIdV2 { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SePassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SeTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SgNationalRegistrationIdentityCardNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SiTaxIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SiUniqueMasterCitizenNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SkPersonalNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SqlServerConnectionString { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory SwiftCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ThPopulationIdentificationCode { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory TrNationalIdentificationNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory TwNationalId { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory TwPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory TwResidentCertificate { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UaPassportNumberDomestic { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UaPassportNumberInternational { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UkDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UkElectoralRollNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UkNationalHealthNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UkNationalInsuranceNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UkUniqueTaxpayerNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory URL { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UsBankAccountNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UsDriversLicenseNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UsIndividualTaxpayerIdentification { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UsSocialSecurityNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory UsUkPassportNumber { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiCategory ZaIdentificationNumber { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.PiiCategory other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.PiiCategory left, Azure.AI.Language.Text.Models.PiiCategory right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.PiiCategory (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.PiiCategory left, Azure.AI.Language.Text.Models.PiiCategory right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PiiDomain : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PiiDomain(string value) { throw null; } + public static Azure.AI.Language.Text.Models.PiiDomain None { get { throw null; } } + public static Azure.AI.Language.Text.Models.PiiDomain Phi { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.PiiDomain other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.PiiDomain left, Azure.AI.Language.Text.Models.PiiDomain right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.PiiDomain (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.PiiDomain left, Azure.AI.Language.Text.Models.PiiDomain right) { throw null; } + public override string ToString() { throw null; } + } + public partial class PiiEntityRecognitionOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiEntityRecognitionOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.PiiResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.PiiEntityRecognitionOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.PiiEntityRecognitionOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PiiOperationAction() { } + public Azure.AI.Language.Text.Models.PiiActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.PiiOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.PiiOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.PiiResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.PiiResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PiiResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PiiResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Entities { get { throw null; } } + public string Id { get { throw null; } } + public string RedactedText { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.PiiResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.PiiResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class PrebuiltComponent : Azure.AI.Language.Text.Models.EntityComponentInformation, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal PrebuiltComponent() { } + public string Value { get { throw null; } } + Azure.AI.Language.Text.Models.PrebuiltComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.PrebuiltComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RangeInclusivity : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RangeInclusivity(string value) { throw null; } + public static Azure.AI.Language.Text.Models.RangeInclusivity LeftInclusive { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeInclusivity LeftRightInclusive { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeInclusivity NoneInclusive { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeInclusivity RightInclusive { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.RangeInclusivity other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.RangeInclusivity left, Azure.AI.Language.Text.Models.RangeInclusivity right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.RangeInclusivity (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.RangeInclusivity left, Azure.AI.Language.Text.Models.RangeInclusivity right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RangeKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RangeKind(string value) { throw null; } + public static Azure.AI.Language.Text.Models.RangeKind Age { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Area { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Currency { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Information { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Length { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Number { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Speed { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Temperature { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Volume { get { throw null; } } + public static Azure.AI.Language.Text.Models.RangeKind Weight { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.RangeKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.RangeKind left, Azure.AI.Language.Text.Models.RangeKind right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.RangeKind (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.RangeKind left, Azure.AI.Language.Text.Models.RangeKind right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RedactionCharacter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RedactionCharacter(string value) { throw null; } + public static Azure.AI.Language.Text.Models.RedactionCharacter Ampersand { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Asterisk { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter AtSign { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Caret { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Dollar { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter EqualsValue { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter ExclamationPoint { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Minus { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter NumberSign { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter PerCent { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Plus { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter QuestionMark { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Tilde { get { throw null; } } + public static Azure.AI.Language.Text.Models.RedactionCharacter Underscore { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.RedactionCharacter other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.RedactionCharacter left, Azure.AI.Language.Text.Models.RedactionCharacter right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.RedactionCharacter (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.RedactionCharacter left, Azure.AI.Language.Text.Models.RedactionCharacter right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RelationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RelationType(string value) { throw null; } + public static Azure.AI.Language.Text.Models.RelationType Abbreviation { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType BodySiteOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType BodySiteOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType CourseOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType CourseOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType CourseOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType CourseOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType DirectionOfBodyStructure { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType DirectionOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType DirectionOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType DirectionOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType DosageOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType ExaminationFindsCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType ExpressionOfGene { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType ExpressionOfVariant { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType FormOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType FrequencyOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType FrequencyOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType FrequencyOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType MutationTypeOfGene { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType MutationTypeOfVariant { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType QualifierOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType RelationOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType RouteOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType ScaleOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType TimeOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType TimeOfEvent { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType TimeOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType TimeOfMedication { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType TimeOfTreatment { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType UnitOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType UnitOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType ValueOfCondition { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType ValueOfExamination { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelationType VariantOfGene { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.RelationType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.RelationType left, Azure.AI.Language.Text.Models.RelationType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.RelationType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.RelationType left, Azure.AI.Language.Text.Models.RelationType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RelativeTo : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RelativeTo(string value) { throw null; } + public static Azure.AI.Language.Text.Models.RelativeTo Current { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelativeTo End { get { throw null; } } + public static Azure.AI.Language.Text.Models.RelativeTo Start { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.RelativeTo other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.RelativeTo left, Azure.AI.Language.Text.Models.RelativeTo right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.RelativeTo (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.RelativeTo left, Azure.AI.Language.Text.Models.RelativeTo right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequestStatistics : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RequestStatistics() { } + public int DocumentsCount { get { throw null; } } + public int ErroneousDocumentsCount { get { throw null; } } + public long TransactionsCount { get { throw null; } } + public int ValidDocumentsCount { get { throw null; } } + Azure.AI.Language.Text.Models.RequestStatistics System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.RequestStatistics System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScriptCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScriptCode(string value) { throw null; } + public static Azure.AI.Language.Text.Models.ScriptCode Arab { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Armn { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Beng { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Cans { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Cyrl { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Deva { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Ethi { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Geor { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Grek { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Gujr { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Guru { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Hang { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Hans { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Hant { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Hebr { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Jpan { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Khmr { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Knda { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Laoo { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Latn { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Mlym { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Mymr { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Orya { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Sinh { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Taml { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Telu { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Thaa { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Thai { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptCode Tibt { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.ScriptCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.ScriptCode left, Azure.AI.Language.Text.Models.ScriptCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.ScriptCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.ScriptCode left, Azure.AI.Language.Text.Models.ScriptCode right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ScriptKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ScriptKind(string value) { throw null; } + public static Azure.AI.Language.Text.Models.ScriptKind Arabic { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Armenian { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Bangla { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Cyrillic { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Devanagari { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Ethiopic { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Georgian { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Greek { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Gujarati { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Gurmukhi { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Hangul { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind HanSimplified { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind HanTraditional { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Hebrew { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Japanese { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Kannada { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Khmer { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Lao { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Latin { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Malayalam { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Myanmar { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Odia { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Sinhala { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Tamil { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Telugu { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Thaana { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Thai { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind Tibetan { get { throw null; } } + public static Azure.AI.Language.Text.Models.ScriptKind UnifiedCanadianAboriginalSyllabics { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.ScriptKind other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.ScriptKind left, Azure.AI.Language.Text.Models.ScriptKind right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.ScriptKind (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.ScriptKind left, Azure.AI.Language.Text.Models.ScriptKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SentenceAssessment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentenceAssessment() { } + public Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel ConfidenceScores { get { throw null; } } + public bool IsNegated { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public Azure.AI.Language.Text.Models.TokenSentiment Sentiment { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.SentenceAssessment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentenceAssessment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentenceSentiment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentenceSentiment() { } + public System.Collections.Generic.IReadOnlyList Assessments { get { throw null; } } + public Azure.AI.Language.Text.Models.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public Azure.AI.Language.Text.Models.SentenceSentimentValue Sentiment { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Targets { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.SentenceSentiment System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentenceSentiment System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum SentenceSentimentValue + { + Positive = 0, + Neutral = 1, + Negative = 2, + } + public partial class SentenceTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentenceTarget() { } + public Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel ConfidenceScores { get { throw null; } } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Relations { get { throw null; } } + public Azure.AI.Language.Text.Models.TokenSentiment Sentiment { get { throw null; } } + public string Text { get { throw null; } } + Azure.AI.Language.Text.Models.SentenceTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentenceTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentAnalysisActionContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SentimentAnalysisActionContent() { } + public bool? LoggingOptOut { get { throw null; } set { } } + public string ModelVersion { get { throw null; } set { } } + public bool? OpinionMining { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.StringIndexType? StringIndexType { get { throw null; } set { } } + Azure.AI.Language.Text.Models.SentimentAnalysisActionContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentimentAnalysisActionContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentAnalysisOperationAction : Azure.AI.Language.Text.Models.AnalyzeTextOperationAction, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SentimentAnalysisOperationAction() { } + public Azure.AI.Language.Text.Models.SentimentAnalysisActionContent ActionContent { get { throw null; } set { } } + Azure.AI.Language.Text.Models.SentimentAnalysisOperationAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentimentAnalysisOperationAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentConfidenceScores : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentConfidenceScores() { } + public double Negative { get { throw null; } } + public double Neutral { get { throw null; } } + public double Positive { get { throw null; } } + Azure.AI.Language.Text.Models.SentimentConfidenceScores System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentimentConfidenceScores System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentDocumentResultWithDetectedLanguage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentDocumentResultWithDetectedLanguage() { } + public Azure.AI.Language.Text.Models.SentimentConfidenceScores ConfidenceScores { get { throw null; } } + public Azure.AI.Language.Text.Models.DetectedLanguage DetectedLanguage { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Sentences { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentSentiment Sentiment { get { throw null; } } + public Azure.AI.Language.Text.Models.DocumentStatistics Statistics { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Warnings { get { throw null; } } + Azure.AI.Language.Text.Models.SentimentDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentimentDocumentResultWithDetectedLanguage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentOperationResult : Azure.AI.Language.Text.Models.AnalyzeTextOperationResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentOperationResult() : base (default(System.DateTimeOffset), default(Azure.AI.Language.Text.Models.TextActionState)) { } + public Azure.AI.Language.Text.Models.SentimentResult Results { get { throw null; } } + Azure.AI.Language.Text.Models.SentimentOperationResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentimentOperationResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SentimentResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SentimentResult() { } + public System.Collections.Generic.IReadOnlyList Documents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string ModelVersion { get { throw null; } } + public Azure.AI.Language.Text.Models.RequestStatistics Statistics { get { throw null; } } + Azure.AI.Language.Text.Models.SentimentResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SentimentResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class SpeedMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SpeedMetadata() { } + public Azure.AI.Language.Text.Models.SpeedUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.SpeedMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SpeedMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SpeedUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SpeedUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.SpeedUnit CentimetersPerMillisecond { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit FeetPerMinute { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit FeetPerSecond { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit KilometersPerHour { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit KilometersPerMillisecond { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit KilometersPerMinute { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit KilometersPerSecond { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit Knots { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit MetersPerMillisecond { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit MetersPerSecond { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit MilesPerHour { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit Unspecified { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit YardsPerMinute { get { throw null; } } + public static Azure.AI.Language.Text.Models.SpeedUnit YardsPerSecond { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.SpeedUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.SpeedUnit left, Azure.AI.Language.Text.Models.SpeedUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.SpeedUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.SpeedUnit left, Azure.AI.Language.Text.Models.SpeedUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StringIndexType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StringIndexType(string value) { throw null; } + public static Azure.AI.Language.Text.Models.StringIndexType TextElementsV8 { get { throw null; } } + public static Azure.AI.Language.Text.Models.StringIndexType UnicodeCodePoint { get { throw null; } } + public static Azure.AI.Language.Text.Models.StringIndexType Utf16CodeUnit { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.StringIndexType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.StringIndexType left, Azure.AI.Language.Text.Models.StringIndexType right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.StringIndexType (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.StringIndexType left, Azure.AI.Language.Text.Models.StringIndexType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SummaryContext : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SummaryContext() { } + public int Length { get { throw null; } } + public int Offset { get { throw null; } } + Azure.AI.Language.Text.Models.SummaryContext System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.SummaryContext System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SummaryLengthBucket : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SummaryLengthBucket(string value) { throw null; } + public static Azure.AI.Language.Text.Models.SummaryLengthBucket Long { get { throw null; } } + public static Azure.AI.Language.Text.Models.SummaryLengthBucket Medium { get { throw null; } } + public static Azure.AI.Language.Text.Models.SummaryLengthBucket Short { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.SummaryLengthBucket other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.SummaryLengthBucket left, Azure.AI.Language.Text.Models.SummaryLengthBucket right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.SummaryLengthBucket (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.SummaryLengthBucket left, Azure.AI.Language.Text.Models.SummaryLengthBucket right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TargetConfidenceScoreLabel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TargetConfidenceScoreLabel() { } + public double Negative { get { throw null; } } + public double Positive { get { throw null; } } + Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TargetConfidenceScoreLabel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TargetRelation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TargetRelation() { } + public string Ref { get { throw null; } } + public Azure.AI.Language.Text.Models.TargetRelationType RelationType { get { throw null; } } + Azure.AI.Language.Text.Models.TargetRelation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TargetRelation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum TargetRelationType + { + Assessment = 0, + Target = 1, + } + public partial class TemperatureMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemperatureMetadata() { } + public Azure.AI.Language.Text.Models.TemperatureUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.TemperatureMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TemperatureMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TemperatureUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TemperatureUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.TemperatureUnit Celsius { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemperatureUnit Fahrenheit { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemperatureUnit Kelvin { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemperatureUnit Rankine { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemperatureUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.TemperatureUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.TemperatureUnit left, Azure.AI.Language.Text.Models.TemperatureUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.TemperatureUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.TemperatureUnit left, Azure.AI.Language.Text.Models.TemperatureUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TemporalModifier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TemporalModifier(string value) { throw null; } + public static Azure.AI.Language.Text.Models.TemporalModifier After { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier AfterApprox { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier AfterMid { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier AfterStart { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Approx { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Before { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier BeforeApprox { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier BeforeEnd { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier BeforeStart { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier End { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Less { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Mid { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier More { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier ReferenceUndefined { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Since { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier SinceEnd { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Start { get { throw null; } } + public static Azure.AI.Language.Text.Models.TemporalModifier Until { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.TemporalModifier other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.TemporalModifier left, Azure.AI.Language.Text.Models.TemporalModifier right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.TemporalModifier (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.TemporalModifier left, Azure.AI.Language.Text.Models.TemporalModifier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TemporalSetMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemporalSetMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + Azure.AI.Language.Text.Models.TemporalSetMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TemporalSetMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TemporalSpanMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemporalSpanMetadata() { } + public System.Collections.Generic.IReadOnlyList SpanValues { get { throw null; } } + Azure.AI.Language.Text.Models.TemporalSpanMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TemporalSpanMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TemporalSpanValues : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemporalSpanValues() { } + public string Begin { get { throw null; } } + public string Duration { get { throw null; } } + public string End { get { throw null; } } + public Azure.AI.Language.Text.Models.TemporalModifier? Modifier { get { throw null; } } + public string Timex { get { throw null; } } + Azure.AI.Language.Text.Models.TemporalSpanValues System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TemporalSpanValues System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextActions : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TextActions() { } + public int Completed { get { throw null; } } + public int Failed { get { throw null; } } + public int InProgress { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Items { get { throw null; } } + public int Total { get { throw null; } } + Azure.AI.Language.Text.Models.TextActions System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextActions System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct TextActionState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TextActionState(string value) { throw null; } + public static Azure.AI.Language.Text.Models.TextActionState Cancelled { get { throw null; } } + public static Azure.AI.Language.Text.Models.TextActionState Cancelling { get { throw null; } } + public static Azure.AI.Language.Text.Models.TextActionState Failed { get { throw null; } } + public static Azure.AI.Language.Text.Models.TextActionState NotStarted { get { throw null; } } + public static Azure.AI.Language.Text.Models.TextActionState PartiallyCompleted { get { throw null; } } + public static Azure.AI.Language.Text.Models.TextActionState Running { get { throw null; } } + public static Azure.AI.Language.Text.Models.TextActionState Succeeded { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.TextActionState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.TextActionState left, Azure.AI.Language.Text.Models.TextActionState right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.TextActionState (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.TextActionState left, Azure.AI.Language.Text.Models.TextActionState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TextDynamicClassificationInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextDynamicClassificationInput() { } + public Azure.AI.Language.Text.Models.DynamicClassificationActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.MultiLanguageTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextDynamicClassificationInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextDynamicClassificationInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextEntityLinkingInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextEntityLinkingInput() { } + public Azure.AI.Language.Text.Models.EntityLinkingActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.MultiLanguageTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextEntityLinkingInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextEntityLinkingInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextEntityRecognitionInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextEntityRecognitionInput() { } + public Azure.AI.Language.Text.Models.EntitiesActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.MultiLanguageTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextEntityRecognitionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextEntityRecognitionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextKeyPhraseExtractionInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextKeyPhraseExtractionInput() { } + public Azure.AI.Language.Text.Models.KeyPhraseActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.MultiLanguageTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextKeyPhraseExtractionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextKeyPhraseExtractionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextLanguageDetectionInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextLanguageDetectionInput() { } + public Azure.AI.Language.Text.Models.LanguageDetectionActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.LanguageDetectionTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextLanguageDetectionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextLanguageDetectionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextPiiEntitiesRecognitionInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextPiiEntitiesRecognitionInput() { } + public Azure.AI.Language.Text.Models.PiiActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.MultiLanguageTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextPiiEntitiesRecognitionInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextPiiEntitiesRecognitionInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TextSentimentAnalysisInput : Azure.AI.Language.Text.Models.AnalyzeTextInput, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TextSentimentAnalysisInput() { } + public Azure.AI.Language.Text.Models.SentimentAnalysisActionContent ActionContent { get { throw null; } set { } } + public Azure.AI.Language.Text.Models.MultiLanguageTextInput TextInput { get { throw null; } set { } } + Azure.AI.Language.Text.Models.TextSentimentAnalysisInput System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TextSentimentAnalysisInput System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class TimeMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TimeMetadata() { } + public System.Collections.Generic.IReadOnlyList Dates { get { throw null; } } + Azure.AI.Language.Text.Models.TimeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.TimeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public enum TokenSentiment + { + Positive = 0, + Mixed = 1, + Negative = 2, + } + public partial class VolumeMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal VolumeMetadata() { } + public Azure.AI.Language.Text.Models.VolumeUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.VolumeMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.VolumeMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct VolumeUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public VolumeUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.VolumeUnit Barrel { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Bushel { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Centiliter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Cord { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicCentimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicFoot { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicInch { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicMeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicMile { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicMillimeter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit CubicYard { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Cup { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Decaliter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit FluidDram { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit FluidOunce { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Gill { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Hectoliter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Hogshead { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Liter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Milliliter { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Minim { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Peck { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Pinch { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Pint { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Quart { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Tablespoon { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Teaspoon { get { throw null; } } + public static Azure.AI.Language.Text.Models.VolumeUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.VolumeUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.VolumeUnit left, Azure.AI.Language.Text.Models.VolumeUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.VolumeUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.VolumeUnit left, Azure.AI.Language.Text.Models.VolumeUnit right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct WarningCode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WarningCode(string value) { throw null; } + public static Azure.AI.Language.Text.Models.WarningCode DocumentTruncated { get { throw null; } } + public static Azure.AI.Language.Text.Models.WarningCode LongWordsInDocument { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.WarningCode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.WarningCode left, Azure.AI.Language.Text.Models.WarningCode right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.WarningCode (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.WarningCode left, Azure.AI.Language.Text.Models.WarningCode right) { throw null; } + public override string ToString() { throw null; } + } + public partial class WeightMetadata : Azure.AI.Language.Text.Models.BaseMetadata, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WeightMetadata() { } + public Azure.AI.Language.Text.Models.WeightUnit Unit { get { throw null; } } + public double Value { get { throw null; } } + Azure.AI.Language.Text.Models.WeightMetadata System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Language.Text.Models.WeightMetadata System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct WeightUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WeightUnit(string value) { throw null; } + public static Azure.AI.Language.Text.Models.WeightUnit Dram { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Gallon { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Grain { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Gram { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Kilogram { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit LongTonBritish { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit MetricTon { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Milligram { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Ounce { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit PennyWeight { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Pound { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit ShortHundredWeightUs { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit ShortTonUs { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Stone { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Ton { get { throw null; } } + public static Azure.AI.Language.Text.Models.WeightUnit Unspecified { get { throw null; } } + public bool Equals(Azure.AI.Language.Text.Models.WeightUnit other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.AI.Language.Text.Models.WeightUnit left, Azure.AI.Language.Text.Models.WeightUnit right) { throw null; } + public static implicit operator Azure.AI.Language.Text.Models.WeightUnit (string value) { throw null; } + public static bool operator !=(Azure.AI.Language.Text.Models.WeightUnit left, Azure.AI.Language.Text.Models.WeightUnit right) { throw null; } + public override string ToString() { throw null; } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class AILanguageTextClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, System.Uri endpoint, Azure.AzureKeyCredential credential) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj new file mode 100644 index 0000000000000..0257d655f4507 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Azure.AI.Language.Text.csproj @@ -0,0 +1,20 @@ + + + This is the Azure.AI.Language.Text client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.AI.Language.Text for Azure Data Plane + 1.0.0-beta.1 + Azure.AI.Language.Text + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs new file mode 100644 index 0000000000000..9bae8b4e15b05 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextClientBuilderExtensions.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure; +using Azure.AI.Language.Text; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AILanguageTextClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + public static IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new TextAnalysisClient(endpoint, credential, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + public static IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new TextAnalysisClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddTextAnalysisClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs new file mode 100644 index 0000000000000..f772ac8123b3e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/AILanguageTextModelFactory.cs @@ -0,0 +1,1700 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Model factory for models. + public static partial class AILanguageTextModelFactory + { + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default. (Following only applies to 2023-04-15-preview and above) For Auto Language Detection, use \"auto\". If not set, use \"en\" for English as default. + /// A new instance for mocking. + public static MultiLanguageInput MultiLanguageInput(string id = null, string text = null, string language = null) + { + return new MultiLanguageInput(id, text, language, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// The country hint to help with language detection of the text. + /// A new instance for mocking. + public static LanguageInput LanguageInput(string id = null, string text = null, string countryHint = null) + { + return new LanguageInput(id, text, countryHint, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Results for Dynamic Classification task. + /// A new instance for mocking. + public static AnalyzeTextDynamicClassificationResult AnalyzeTextDynamicClassificationResult(DynamicClassificationResult results = null) + { + return new AnalyzeTextDynamicClassificationResult(AnalyzeTextResultsKind.DynamicClassificationResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static DynamicClassificationResult DynamicClassificationResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new DynamicClassificationResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// A new instance for mocking. + public static DocumentError DocumentError(string id = null, AnalyzeTextError error = null) + { + return new DocumentError(id, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// A human-readable representation of the error. + /// The target of the error. + /// An array of details about specific errors that led to this reported error. + /// An object containing more specific information than the current object about the error. + /// A new instance for mocking. + public static AnalyzeTextError AnalyzeTextError(AnalyzeTextErrorCode code = default, string message = null, string target = null, IEnumerable details = null, InnerErrorModel innererror = null) + { + details ??= new List(); + + return new AnalyzeTextError( + code, + message, + target, + details?.ToList(), + innererror, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// Error message. + /// Error details. + /// Error target. + /// An object containing more specific information than the current object about the error. + /// A new instance for mocking. + public static InnerErrorModel InnerErrorModel(InnerErrorCode code = default, string message = null, IReadOnlyDictionary details = null, string target = null, InnerErrorModel innererror = null) + { + details ??= new Dictionary(); + + return new InnerErrorModel( + code, + message, + details, + target, + innererror, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of documents submitted in the request. + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + /// Number of transactions for the request. + /// A new instance for mocking. + public static RequestStatistics RequestStatistics(int documentsCount = default, int validDocumentsCount = default, int erroneousDocumentsCount = default, long transactionsCount = default) + { + return new RequestStatistics(documentsCount, validDocumentsCount, erroneousDocumentsCount, transactionsCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Array of classification results. + /// A new instance for mocking. + public static DynamicClassificationDocumentResult DynamicClassificationDocumentResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable classifications = null) + { + warnings ??= new List(); + classifications ??= new List(); + + return new DynamicClassificationDocumentResult(id, warnings?.ToList(), statistics, classifications?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// A JSON pointer reference indicating the target object. + /// A new instance for mocking. + public static DocumentWarning DocumentWarning(WarningCode code = default, string message = null, string targetRef = null) + { + return new DocumentWarning(code, message, targetRef, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Number of text elements recognized in the document. + /// Number of transactions for the document. + /// A new instance for mocking. + public static DocumentStatistics DocumentStatistics(int charactersCount = default, int transactionsCount = default) + { + return new DocumentStatistics(charactersCount, transactionsCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Classification type. + /// Confidence score between 0 and 1 of the recognized class. + /// A new instance for mocking. + public static ClassificationResult ClassificationResult(string category = null, double confidenceScore = default) + { + return new ClassificationResult(category, confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity linking result. + /// A new instance for mocking. + public static AnalyzeTextEntityLinkingResult AnalyzeTextEntityLinkingResult(EntityLinkingResult results = null) + { + return new AnalyzeTextEntityLinkingResult(AnalyzeTextResultsKind.EntityLinkingResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static EntityLinkingResult EntityLinkingResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new EntityLinkingResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized well known entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static EntityLinkingResultWithDetectedLanguage EntityLinkingResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new EntityLinkingResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity Linking formal name. + /// List of instances this entity appears in the text. + /// Language used in the data source. + /// Unique identifier of the recognized entity from the data source. + /// URL for the entity's page from the data source. + /// Data source used to extract entity linking, such as Wiki/Bing etc. + /// Bing Entity Search API unique identifier of the recognized entity. + /// A new instance for mocking. + public static LinkedEntity LinkedEntity(string name = null, IEnumerable matches = null, string language = null, string id = null, string url = null, string dataSource = null, string bingId = null) + { + matches ??= new List(); + + return new LinkedEntity( + name, + matches?.ToList(), + language, + id, + url, + dataSource, + bingId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + /// Entity text as appears in the request. + /// Start position for the entity match text. + /// Length for the entity match text. + /// A new instance for mocking. + public static EntityLinkingMatch EntityLinkingMatch(double confidenceScore = default, string text = null, int offset = default, int length = default) + { + return new EntityLinkingMatch(confidenceScore, text, offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Long name of a detected language (e.g. English, French). + /// A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + /// A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + /// Identifies the script of the input document. + /// Identifies the script of the input document. + /// A new instance for mocking. + public static DetectedLanguage DetectedLanguage(string name = null, string iso6391Name = null, double confidenceScore = default, ScriptKind? script = null, ScriptCode? scriptCode = null) + { + return new DetectedLanguage( + name, + iso6391Name, + confidenceScore, + script, + scriptCode, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Results for entity recognition. + /// A new instance for mocking. + public static AnalyzeTextEntitiesResult AnalyzeTextEntitiesResult(EntitiesResult results = null) + { + return new AnalyzeTextEntitiesResult(AnalyzeTextResultsKind.EntityRecognitionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static EntitiesResult EntitiesResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new EntitiesResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static EntitiesDocumentResultWithMetadataDetectedLanguage EntitiesDocumentResultWithMetadataDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new EntitiesDocumentResultWithMetadataDetectedLanguage( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + /// List of entity tags. Tags are to express some similarities/affinity between entities. + /// + /// The entity metadata object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + /// A new instance for mocking. + public static NamedEntityWithMetadata NamedEntityWithMetadata(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, string type = null, IEnumerable tags = null, BaseMetadata metadata = null) + { + tags ??= new List(); + + return new NamedEntityWithMetadata( + text, + category, + subcategory, + offset, + length, + confidenceScore, + type, + tags?.ToList(), + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the tag. Entity Tag names will be unique globally. + /// Detection score between 0 and 1 of the extracted entity. + /// A new instance for mocking. + public static EntityTag EntityTag(string name = null, double? confidenceScore = null) + { + return new EntityTag(name, confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for age. + /// A new instance for mocking. + public static AgeMetadata AgeMetadata(double value = default, AgeUnit unit = default) + { + return new AgeMetadata(MetadataKind.AgeMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for volume. + /// A new instance for mocking. + public static VolumeMetadata VolumeMetadata(double value = default, VolumeUnit unit = default) + { + return new VolumeMetadata(MetadataKind.VolumeMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for speed. + /// A new instance for mocking. + public static SpeedMetadata SpeedMetadata(double value = default, SpeedUnit unit = default) + { + return new SpeedMetadata(MetadataKind.SpeedMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for area. + /// A new instance for mocking. + public static AreaMetadata AreaMetadata(double value = default, AreaUnit unit = default) + { + return new AreaMetadata(MetadataKind.AreaMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for length. + /// A new instance for mocking. + public static LengthMetadata LengthMetadata(double value = default, LengthUnit unit = default) + { + return new LengthMetadata(MetadataKind.LengthMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for information. + /// A new instance for mocking. + public static InformationMetadata InformationMetadata(double value = default, InformationUnit unit = default) + { + return new InformationMetadata(MetadataKind.InformationMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for temperature. + /// A new instance for mocking. + public static TemperatureMetadata TemperatureMetadata(double value = default, TemperatureUnit unit = default) + { + return new TemperatureMetadata(MetadataKind.TemperatureMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for weight. + /// A new instance for mocking. + public static WeightMetadata WeightMetadata(double value = default, WeightUnit unit = default) + { + return new WeightMetadata(MetadataKind.WeightMetadata, serializedAdditionalRawData: null, value, unit); + } + + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Currency unit. + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + /// A new instance for mocking. + public static CurrencyMetadata CurrencyMetadata(double value = default, string unit = null, string iso4217 = null) + { + return new CurrencyMetadata(MetadataKind.CurrencyMetadata, serializedAdditionalRawData: null, value, unit, iso4217); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static DateMetadata DateMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new DateMetadata(MetadataKind.DateMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The actual time that the extracted text denote. + /// Modifier for datetime to indicate point of reference like before, after etc. + /// A new instance for mocking. + public static DateValue DateValue(string timex = null, string value = null, TemporalModifier? modifier = null) + { + return new DateValue(timex, value, modifier, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static DateTimeMetadata DateTimeMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new DateTimeMetadata(MetadataKind.DateTimeMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static TemporalSetMetadata TemporalSetMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new TemporalSetMetadata(MetadataKind.TemporalSetMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// List of date values. + /// A new instance for mocking. + public static TimeMetadata TimeMetadata(IEnumerable dates = null) + { + dates ??= new List(); + + return new TimeMetadata(MetadataKind.TimeMetadata, serializedAdditionalRawData: null, dates?.ToList()); + } + + /// Initializes a new instance of . + /// Kind of the number type. + /// A numeric representation of what the extracted text denotes. + /// A new instance for mocking. + public static NumberMetadata NumberMetadata(NumberKind numberKind = default, double value = default) + { + return new NumberMetadata(MetadataKind.NumberMetadata, serializedAdditionalRawData: null, numberKind, value); + } + + /// Initializes a new instance of . + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + /// A new instance for mocking. + public static OrdinalMetadata OrdinalMetadata(string offset = null, RelativeTo relativeTo = default, string value = null) + { + return new OrdinalMetadata(MetadataKind.OrdinalMetadata, serializedAdditionalRawData: null, offset, relativeTo, value); + } + + /// Initializes a new instance of . + /// List of temporal spans detected. + /// A new instance for mocking. + public static TemporalSpanMetadata TemporalSpanMetadata(IEnumerable spanValues = null) + { + spanValues ??= new List(); + + return new TemporalSpanMetadata(MetadataKind.TemporalSpanMetadata, serializedAdditionalRawData: null, spanValues?.ToList()); + } + + /// Initializes a new instance of . + /// Start value for the span. + /// End value for the span. + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + /// Modifier for datetime to indicate point of reference like before, after etc. + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + /// A new instance for mocking. + public static TemporalSpanValues TemporalSpanValues(string begin = null, string end = null, string duration = null, TemporalModifier? modifier = null, string timex = null) + { + return new TemporalSpanValues( + begin, + end, + duration, + modifier, + timex, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Kind of numeric ranges supported - like Number, Speed, etc. + /// The beginning value of the interval. + /// The ending value of the interval. + /// The inclusiveness of this range. + /// A new instance for mocking. + public static NumericRangeMetadata NumericRangeMetadata(RangeKind rangeKind = default, double minimum = default, double maximum = default, RangeInclusivity? rangeInclusivity = null) + { + return new NumericRangeMetadata( + MetadataKind.NumericRangeMetadata, + serializedAdditionalRawData: null, + rangeKind, + minimum, + maximum, + rangeInclusivity); + } + + /// Initializes a new instance of . + /// The list of Key phrase extraction results. + /// A new instance for mocking. + public static AnalyzeTextKeyPhraseResult AnalyzeTextKeyPhraseResult(KeyPhraseResult results = null) + { + return new AnalyzeTextKeyPhraseResult(AnalyzeTextResultsKind.KeyPhraseExtractionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static KeyPhraseResult KeyPhraseResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new KeyPhraseResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static KeyPhrasesDocumentResultWithDetectedLanguage KeyPhrasesDocumentResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable keyPhrases = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + keyPhrases ??= new List(); + + return new KeyPhrasesDocumentResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + keyPhrases?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Contains the language detection results. + /// A new instance for mocking. + public static AnalyzeTextLanguageDetectionResult AnalyzeTextLanguageDetectionResult(LanguageDetectionResult results = null) + { + return new AnalyzeTextLanguageDetectionResult(AnalyzeTextResultsKind.LanguageDetectionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Enumeration of language detection results for each input document. + /// A new instance for mocking. + public static LanguageDetectionResult LanguageDetectionResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new LanguageDetectionResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Detected Language. + /// A new instance for mocking. + public static LanguageDetectionDocumentResult LanguageDetectionDocumentResult(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + + return new LanguageDetectionDocumentResult(id, warnings?.ToList(), statistics, detectedLanguage, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The list of pii results. + /// A new instance for mocking. + public static AnalyzeTextPiiResult AnalyzeTextPiiResult(PiiResult results = null) + { + return new AnalyzeTextPiiResult(AnalyzeTextResultsKind.PiiEntityRecognitionResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static PiiResult PiiResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new PiiResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Returns redacted text. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static PiiResultWithDetectedLanguage PiiResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, string redactedText = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new PiiResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + redactedText, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// A new instance for mocking. + public static NamedEntity NamedEntity(string text = null, string category = null, string subcategory = null, int offset = default, int length = default, double confidenceScore = default) + { + return new NamedEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentiment analysis results. + /// A new instance for mocking. + public static AnalyzeTextSentimentResult AnalyzeTextSentimentResult(SentimentResult results = null) + { + return new AnalyzeTextSentimentResult(AnalyzeTextResultsKind.SentimentAnalysisResults, serializedAdditionalRawData: null, results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// The sentiment analysis results for each document in the input. + /// A new instance for mocking. + public static SentimentResult SentimentResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new SentimentResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static SentimentDocumentResultWithDetectedLanguage SentimentDocumentResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DocumentSentiment sentiment = default, SentimentConfidenceScores confidenceScores = null, IEnumerable sentences = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + sentences ??= new List(); + + return new SentimentDocumentResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + sentiment, + confidenceScores, + sentences?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for neutral sentiment. + /// Confidence score for negative sentiment. + /// A new instance for mocking. + public static SentimentConfidenceScores SentimentConfidenceScores(double positive = default, double neutral = default, double negative = default) + { + return new SentimentConfidenceScores(positive, neutral, negative, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The array of sentence targets for the sentence. + /// The array of assessments for the sentence. + /// A new instance for mocking. + public static SentenceSentiment SentenceSentiment(string text = null, SentenceSentimentValue sentiment = default, SentimentConfidenceScores confidenceScores = null, int offset = default, int length = default, IEnumerable targets = null, IEnumerable assessments = null) + { + targets ??= new List(); + assessments ??= new List(); + + return new SentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + targets?.ToList(), + assessments?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The array of either assessment or target objects which is related to the target. + /// A new instance for mocking. + public static SentenceTarget SentenceTarget(TokenSentiment sentiment = default, TargetConfidenceScoreLabel confidenceScores = null, int offset = default, int length = default, string text = null, IEnumerable relations = null) + { + relations ??= new List(); + + return new SentenceTarget( + sentiment, + confidenceScores, + offset, + length, + text, + relations?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for negative sentiment. + /// A new instance for mocking. + public static TargetConfidenceScoreLabel TargetConfidenceScoreLabel(double positive = default, double negative = default) + { + return new TargetConfidenceScoreLabel(positive, negative, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The JSON pointer indicating the linked object. + /// The type related to the target. + /// A new instance for mocking. + public static TargetRelation TargetRelation(string @ref = null, TargetRelationType relationType = default) + { + return new TargetRelation(@ref, relationType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The indicator representing if the assessment is negated. + /// A new instance for mocking. + public static SentenceAssessment SentenceAssessment(TokenSentiment sentiment = default, TargetConfidenceScoreLabel confidenceScores = null, int offset = default, int length = default, string text = null, bool isNegated = default) + { + return new SentenceAssessment( + sentiment, + confidenceScores, + offset, + length, + text, + isNegated, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// display name. + /// Date and time job created. + /// Date and time job expires. + /// job ID. + /// last updated date and time. + /// status. + /// errors. + /// next link. + /// List of tasks. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// A new instance for mocking. + public static AnalyzeTextOperationState AnalyzeTextOperationState(string displayName = null, DateTimeOffset createdAt = default, DateTimeOffset? expiresOn = null, Guid jobId = default, DateTimeOffset lastUpdatedAt = default, TextActionState status = default, IEnumerable errors = null, string nextLink = null, TextActions actions = null, RequestStatistics statistics = null) + { + errors ??= new List(); + + return new AnalyzeTextOperationState( + displayName, + createdAt, + expiresOn, + jobId, + lastUpdatedAt, + status, + errors?.ToList(), + nextLink, + actions, + statistics, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + /// + /// Enumerable of Analyze text job results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// A new instance for mocking. + public static TextActions TextActions(int completed = default, int failed = default, int inProgress = default, int total = default, IEnumerable items = null) + { + items ??= new List(); + + return new TextActions( + completed, + failed, + inProgress, + total, + items?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// A new instance for mocking. + public static AnalyzeTextOperationResult AnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, string kind = null) + { + return new UnknownAnalyzeTextOperationResult(lastUpdateDateTime, status, name, kind == null ? default : new AnalyzeTextOperationResultsKind(kind), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// List of results. + /// A new instance for mocking. + public static CustomEntityRecognitionOperationResult CustomEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomEntitiesResultWithDocumentDetectedLanguage results = null) + { + return new CustomEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomEntityRecognitionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Enumeration of the document results with detected language. + /// A new instance for mocking. + public static CustomEntitiesResultWithDocumentDetectedLanguage CustomEntitiesResultWithDocumentDetectedLanguage(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomEntitiesResultWithDocumentDetectedLanguage( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static EntitiesDocumentResultWithDetectedLanguage EntitiesDocumentResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + + return new EntitiesDocumentResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// List of results. + /// A new instance for mocking. + public static CustomSingleLabelClassificationOperationResult CustomSingleLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomLabelClassificationResultWithDocumentDetectedLanguage results = null) + { + return new CustomSingleLabelClassificationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomSingleLabelClassificationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Response by document. + /// A new instance for mocking. + public static CustomLabelClassificationResultWithDocumentDetectedLanguage CustomLabelClassificationResultWithDocumentDetectedLanguage(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomLabelClassificationResultWithDocumentDetectedLanguage( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Contains the classification doc results for all docs. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static ClassificationDocumentResultWithDetectedLanguage ClassificationDocumentResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable @class = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + @class ??= new List(); + + return new ClassificationDocumentResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + @class?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// List of results. + /// A new instance for mocking. + public static CustomMultiLabelClassificationOperationResult CustomMultiLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomLabelClassificationResultWithDocumentDetectedLanguage results = null) + { + return new CustomMultiLabelClassificationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomMultiLabelClassificationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Entity linking result. + /// A new instance for mocking. + public static EntityLinkingOperationResult EntityLinkingOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, EntityLinkingResult results = null) + { + return new EntityLinkingOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.EntityLinkingOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results for the task. + /// A new instance for mocking. + public static EntityRecognitionOperationResult EntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, EntitiesResult results = null) + { + return new EntityRecognitionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.EntityRecognitionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static HealthcareOperationResult HealthcareOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, HealthcareResult results = null) + { + return new HealthcareOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.HealthcareOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// List of result objects for the processed Healthcare documents. + /// A new instance for mocking. + public static HealthcareResult HealthcareResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new HealthcareResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, IEnumerable relations = null, FhirBundle fhirBundle = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + relations ??= new List(); + + return new HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + relations?.ToList(), + fhirBundle, + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// A new instance for mocking. + public static HealthcareEntity HealthcareEntity(string text = null, HealthcareEntityCategory category = default, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, HealthcareAssertion assertion = null, string name = null, IEnumerable links = null) + { + links ??= new List(); + + return new HealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Describes any conditionality on the entity. + /// Describes the entities certainty and polarity. + /// Describes if the entity is the subject of the text or if it describes someone else. + /// Describes temporal information regarding the entity. + /// A new instance for mocking. + public static HealthcareAssertion HealthcareAssertion(HealthcareAssertionConditionality? conditionality = null, HealthcareAssertionCertainty? certainty = null, HealthcareAssertionAssociation? association = null, HealthcareAssertionTemporality? temporality = null) + { + return new HealthcareAssertion(conditionality, certainty, association, temporality, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + /// Entity id in the given source catalog. + /// A new instance for mocking. + public static HealthcareEntityLink HealthcareEntityLink(string dataSource = null, string id = null) + { + return new HealthcareEntityLink(dataSource, id, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + /// The entities in the relation. + /// Confidence score between 0 and 1 of the extracted relation. + /// A new instance for mocking. + public static HealthcareRelation HealthcareRelation(RelationType relationType = default, IEnumerable entities = null, double? confidenceScore = null) + { + entities ??= new List(); + + return new HealthcareRelation(relationType, entities?.ToList(), confidenceScore, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + /// A new instance for mocking. + public static HealthcareRelationEntity HealthcareRelationEntity(string @ref = null, string role = null) + { + return new HealthcareRelationEntity(@ref, role, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Additional Properties. + /// A new instance for mocking. + public static FhirBundle FhirBundle(IReadOnlyDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new FhirBundle(additionalProperties); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// The list of Key phrase extraction results. + /// A new instance for mocking. + public static KeyPhraseExtractionOperationResult KeyPhraseExtractionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, KeyPhraseResult results = null) + { + return new KeyPhraseExtractionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.KeyPhraseExtractionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// The list of pii results. + /// A new instance for mocking. + public static PiiEntityRecognitionOperationResult PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, PiiResult results = null) + { + return new PiiEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.PiiEntityRecognitionOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// The sentiment analysis results. + /// A new instance for mocking. + public static SentimentOperationResult SentimentOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, SentimentResult results = null) + { + return new SentimentOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.SentimentAnalysisOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static CustomSentimentAnalysisOperationResult CustomSentimentAnalysisOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomSentimentAnalysisResult results = null) + { + return new CustomSentimentAnalysisOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomSentimentAnalysisOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// The custom sentiment analysis results for each document in the input. + /// A new instance for mocking. + public static CustomSentimentAnalysisResult CustomSentimentAnalysisResult(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomSentimentAnalysisResult( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static CustomSentimentAnalysisResultDocument CustomSentimentAnalysisResultDocument(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, DocumentSentiment sentiment = default, SentimentConfidenceScores confidenceScores = null, IEnumerable sentences = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + sentences ??= new List(); + + return new CustomSentimentAnalysisResultDocument( + id, + warnings?.ToList(), + statistics, + sentiment, + confidenceScores, + sentences?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// A new instance for mocking. + public static CustomSentenceSentiment CustomSentenceSentiment(string text = null, SentenceSentimentValue sentiment = default, SentimentConfidenceScores confidenceScores = null, int offset = default, int length = default) + { + return new CustomSentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static ExtractiveSummarizationOperationResult ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, ExtractiveSummarizationResult results = null) + { + return new ExtractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.ExtractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static ExtractiveSummarizationResult ExtractiveSummarizationResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new ExtractiveSummarizationResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Specifies the the extracted sentences from the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static ExtractedSummaryDocumentResultWithDetectedLanguage ExtractedSummaryDocumentResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable sentences = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + sentences ??= new List(); + + return new ExtractedSummaryDocumentResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + sentences?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The extracted sentence text. + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + /// The length of the sentence. + /// A new instance for mocking. + public static ExtractedSummarySentence ExtractedSummarySentence(string text = null, double rankScore = default, int offset = default, int length = default) + { + return new ExtractedSummarySentence(text, rankScore, offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static AbstractiveSummarizationOperationResult AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, AbstractiveSummarizationResult results = null) + { + return new AbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.AbstractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// A new instance for mocking. + public static AbstractiveSummarizationResult AbstractiveSummarizationResult(IEnumerable errors = null, RequestStatistics statistics = null, string modelVersion = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new AbstractiveSummarizationResult(errors?.ToList(), statistics, modelVersion, documents?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of abstractive summaries. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static AbstractiveSummaryDocumentResultWithDetectedLanguage AbstractiveSummaryDocumentResultWithDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable summaries = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + summaries ??= new List(); + + return new AbstractiveSummaryDocumentResultWithDetectedLanguage( + id, + warnings?.ToList(), + statistics, + summaries?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The text of the summary. + /// The context list of the summary. + /// A new instance for mocking. + public static AbstractiveSummary AbstractiveSummary(string text = null, IEnumerable contexts = null) + { + contexts ??= new List(); + + return new AbstractiveSummary(text, contexts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// A new instance for mocking. + public static SummaryContext SummaryContext(int offset = default, int length = default) + { + return new SummaryContext(offset, length, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Results of the task. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationOperationResult CustomAbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomAbstractiveSummarizationResult results = null) + { + return new CustomAbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomAbstractiveSummarizationOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Response by document. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationResult CustomAbstractiveSummarizationResult(IEnumerable documents = null, IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null) + { + documents ??= new List(); + errors ??= new List(); + + return new CustomAbstractiveSummarizationResult( + documents?.ToList(), + errors?.ToList(), + statistics, + projectName, + deploymentName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Contains the list of document results. + /// A new instance for mocking. + public static CustomHealthcareOperationResult CustomHealthcareOperationResult(DateTimeOffset lastUpdateDateTime = default, TextActionState status = default, string name = null, CustomHealthcareResult results = null) + { + return new CustomHealthcareOperationResult( + lastUpdateDateTime, + status, + name, + AnalyzeTextOperationResultsKind.CustomHealthcareOperationResults, + serializedAdditionalRawData: null, + results); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// List of custom healthcare results for the document. + /// A new instance for mocking. + public static CustomHealthcareResult CustomHealthcareResult(IEnumerable errors = null, RequestStatistics statistics = null, string projectName = null, string deploymentName = null, IEnumerable documents = null) + { + errors ??= new List(); + documents ??= new List(); + + return new CustomHealthcareResult( + errors?.ToList(), + statistics, + projectName, + deploymentName, + documents?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// A new instance for mocking. + public static CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id = null, IEnumerable warnings = null, DocumentStatistics statistics = null, IEnumerable entities = null, IEnumerable relations = null, DetectedLanguage detectedLanguage = null) + { + warnings ??= new List(); + entities ??= new List(); + relations ??= new List(); + + return new CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage( + id, + warnings?.ToList(), + statistics, + entities?.ToList(), + relations?.ToList(), + detectedLanguage, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// + /// (Optional) Entity component information listing fired components of the extracted entity. This object only applies for custom healthcare. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static CustomHealthcareEntity CustomHealthcareEntity(string text = null, HealthcareEntityCategory category = default, string subcategory = null, int offset = default, int length = default, double confidenceScore = default, HealthcareAssertion assertion = null, string name = null, IEnumerable links = null, IEnumerable entityComponentInformation = null) + { + links ??= new List(); + entityComponentInformation ??= new List(); + + return new CustomHealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links?.ToList(), + entityComponentInformation?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The prebuilt component of an extracted entity type. + /// A new instance for mocking. + public static PrebuiltComponent PrebuiltComponent(string value = null) + { + return new PrebuiltComponent(EntityComponentKind.PrebuiltComponent, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// The learned component of an extracted entity type. + /// A new instance for mocking. + public static LearnedComponent LearnedComponent(string value = null) + { + return new LearnedComponent(EntityComponentKind.LearnedComponent, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// The list key of an extracted entity type. + /// A new instance for mocking. + public static ListComponent ListComponent(string value = null) + { + return new ListComponent(EntityComponentKind.ListComponent, serializedAdditionalRawData: null, value); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// A new instance for mocking. + public static CustomEntitiesActionContent CustomEntitiesActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new CustomEntitiesActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomSingleLabelClassificationActionContent CustomSingleLabelClassificationActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null) + { + return new CustomSingleLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomMultiLabelClassificationActionContent CustomMultiLabelClassificationActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null) + { + return new CustomMultiLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Specifies the method used to interpret string offsets. + /// A new instance for mocking. + public static CustomSentimentAnalysisActionContent CustomSentimentAnalysisActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new CustomSentimentAnalysisActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// task name. + /// Parameters for the Custom Abstractive Summarization task. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationOperationAction CustomAbstractiveSummarizationOperationAction(string name = null, CustomAbstractiveSummarizationActionContent actionContent = null) + { + return new CustomAbstractiveSummarizationOperationAction(name, AnalyzeTextOperationActionKind.CustomAbstractiveSummarization, serializedAdditionalRawData: null, actionContent); + } + + /// Initializes a new instance of . + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// A new instance for mocking. + public static CustomAbstractiveSummarizationActionContent CustomAbstractiveSummarizationActionContent(int? sentenceCount = null, StringIndexType? stringIndexType = null, SummaryLengthBucket? summaryLength = null, bool? loggingOptOut = null, string projectName = null, string deploymentName = null) + { + return new CustomAbstractiveSummarizationActionContent( + sentenceCount, + stringIndexType, + summaryLength, + loggingOptOut, + projectName, + deploymentName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// A new instance for mocking. + public static CustomHealthcareActionContent CustomHealthcareActionContent(bool? loggingOptOut = null, string projectName = null, string deploymentName = null, StringIndexType? stringIndexType = null) + { + return new CustomHealthcareActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml new file mode 100644 index 0000000000000..b5f9e0ec95347 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Docs/TextAnalysisClient.xml @@ -0,0 +1,583 @@ + + + + + +This sample shows how to call AnalyzeTextAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput(); +Response response = await client.AnalyzeTextAsync(analyzeTextInput); +]]> +This sample shows how to call AnalyzeTextAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput +{ + TextInput = new MultiLanguageTextInput + { + Documents = {new MultiLanguageInput("", "") + { + Language = "", + }}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "" }) + { + LoggingOptOut = true, + ModelVersion = "", + ClassificationType = ClassificationType.Multi, + }, +}; +Response response = await client.AnalyzeTextAsync(analyzeTextInput, showStatistics: true); +]]> + + + +This sample shows how to call AnalyzeText. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput(); +Response response = client.AnalyzeText(analyzeTextInput); +]]> +This sample shows how to call AnalyzeText with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput +{ + TextInput = new MultiLanguageTextInput + { + Documents = {new MultiLanguageInput("", "") + { + Language = "", + }}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "" }) + { + LoggingOptOut = true, + ModelVersion = "", + ClassificationType = ClassificationType.Multi, + }, +}; +Response response = client.AnalyzeText(analyzeTextInput, showStatistics: true); +]]> + + + +This sample shows how to call AnalyzeTextAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "DynamicClassification", +}); +Response response = await client.AnalyzeTextAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeTextAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "DynamicClassification", + analysisInput = new + { + documents = new object[] + { + new + { + id = "", + text = "", + language = "", + } + }, + }, + parameters = new + { + loggingOptOut = true, + modelVersion = "", + classificationType = "Multi", + categories = new object[] + { + "" + }, + }, +}); +Response response = await client.AnalyzeTextAsync(content, showStatistics: true); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call AnalyzeText and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "DynamicClassification", +}); +Response response = client.AnalyzeText(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> +This sample shows how to call AnalyzeText with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + kind = "DynamicClassification", + analysisInput = new + { + documents = new object[] + { + new + { + id = "", + text = "", + language = "", + } + }, + }, + parameters = new + { + loggingOptOut = true, + modelVersion = "", + classificationType = "Multi", + categories = new object[] + { + "" + }, + }, +}); +Response response = client.AnalyzeText(content, showStatistics: true); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatusAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true, top: 1234, skip: 1234); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatus. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> +This sample shows how to call AnalyzeTextOperationStatus with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true, top: 1234, skip: 1234); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatusAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatusAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, 1234, 1234, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("nextLink").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()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); +]]> + + + +This sample shows how to call AnalyzeTextOperationStatus and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); +]]> +This sample shows how to call AnalyzeTextOperationStatus with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, 1234, 1234, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("createdDateTime").ToString()); +Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); +Console.WriteLine(result.GetProperty("jobId").ToString()); +Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("nextLink").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()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); +Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); +Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput(); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomEntitiesOperationAction() +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + Documents = {new MultiLanguageInput("", "") + { + Language = "", + }}, +}; +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomEntitiesOperationAction + { + ActionContent = new CustomEntitiesActionContent("", "") + { + LoggingOptOut = true, + StringIndexType = StringIndexType.TextElementsV8, + }, + Name = "", + } +}, displayName: "", defaultLanguage: ""); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput(); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomEntitiesOperationAction() +}); +]]> +This sample shows how to call AnalyzeTextSubmitOperation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +MultiLanguageTextInput textInput = new MultiLanguageTextInput +{ + Documents = {new MultiLanguageInput("", "") + { + Language = "", + }}, +}; +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] +{ + new CustomEntitiesOperationAction + { + ActionContent = new CustomEntitiesActionContent("", "") + { + LoggingOptOut = true, + StringIndexType = StringIndexType.TextElementsV8, + }, + Name = "", + } +}, displayName: "", defaultLanguage: ""); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new object(), + tasks = new object[] + { + new + { + kind = "CustomEntityRecognition", + } + }, +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperationAsync with all parameters and request content. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "", + analysisInput = new + { + documents = new object[] + { + new + { + id = "", + text = "", + language = "", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomEntityRecognition", + parameters = new + { + loggingOptOut = true, + projectName = "", + deploymentName = "", + stringIndexType = "TextElements_v8", + }, + taskName = "", + } + }, + defaultLanguage = "", +}); +Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); +]]> + + + +This sample shows how to call AnalyzeTextSubmitOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + analysisInput = new object(), + tasks = new object[] + { + new + { + kind = "CustomEntityRecognition", + } + }, +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> +This sample shows how to call AnalyzeTextSubmitOperation with all parameters and request content. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + displayName = "", + analysisInput = new + { + documents = new object[] + { + new + { + id = "", + text = "", + language = "", + } + }, + }, + tasks = new object[] + { + new + { + kind = "CustomEntityRecognition", + parameters = new + { + loggingOptOut = true, + projectName = "", + deploymentName = "", + stringIndexType = "TextElements_v8", + }, + taskName = "", + } + }, + defaultLanguage = "", +}); +Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); +]]> + + + +This sample shows how to call AnalyzeTextCancelOperationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Operation operation = await client.AnalyzeTextCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> +This sample shows how to call AnalyzeTextCancelOperationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Operation operation = await client.AnalyzeTextCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> + + + +This sample shows how to call AnalyzeTextCancelOperation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Operation operation = client.AnalyzeTextCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> +This sample shows how to call AnalyzeTextCancelOperation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + +Operation operation = client.AnalyzeTextCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); +]]> + + + \ No newline at end of file diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs new file mode 100644 index 0000000000000..461b11edcbb42 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 0000000000000..68b4eee0cd79f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 0000000000000..9843778a0bf08 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 0000000000000..c91db17b0d981 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs new file mode 100644 index 0000000000000..9e68d3016ecc5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.AI.Language.Text +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 0000000000000..663cee94ac18b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 0000000000000..b7b57f12500b7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + 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); + writer.WriteNumberValue(SentenceCount.Value); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(SummaryLength)) + { + writer.WritePropertyName("summaryLength"u8); + writer.WriteStringValue(SummaryLength.Value.ToString()); + } + if (Optional.IsDefined(Query)) + { + writer.WritePropertyName("query"u8); + writer.WriteStringValue(Query); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AbstractiveSummarizationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationActionContent(document.RootElement, options); + } + + internal static AbstractiveSummarizationActionContent DeserializeAbstractiveSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + int? sentenceCount = default; + StringIndexType? stringIndexType = default; + SummaryLengthBucket? summaryLength = default; + string query = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentenceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("summaryLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + summaryLength = new SummaryLengthBucket(property.Value.GetString()); + continue; + } + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationActionContent( + loggingOptOut, + modelVersion, + sentenceCount, + stringIndexType, + summaryLength, + query, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.cs new file mode 100644 index 0000000000000..8d86812ebc203 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationActionContent.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for the pre-built Abstractive Summarization task. + public partial class AbstractiveSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AbstractiveSummarizationActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + /// (Optional) If provided, the query will be used to generate the summary. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummarizationActionContent(bool? loggingOptOut, string modelVersion, int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, string query, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + Query = query; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Controls the approximate number of sentences in the output summaries. + public int? SentenceCount { get; set; } + /// String index type. + public StringIndexType? StringIndexType { get; set; } + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + public SummaryLengthBucket? SummaryLength { get; set; } + /// (Optional) If provided, the query will be used to generate the summary. + public string Query { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..49939c37f5277 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + AbstractiveSummarizationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationOperationAction(document.RootElement, options); + } + + internal static AbstractiveSummarizationOperationAction DeserializeAbstractiveSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AbstractiveSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = AbstractiveSummarizationActionContent.DeserializeAbstractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AbstractiveSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.cs new file mode 100644 index 0000000000000..57706635d2e05 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the task definition for an Abstractive Summarization task. + public partial class AbstractiveSummarizationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public AbstractiveSummarizationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.AbstractiveSummarization; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Abstractive Summarization task. + internal AbstractiveSummarizationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, AbstractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Abstractive Summarization task. + public AbstractiveSummarizationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..4ce65e62418f5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AbstractiveSummarizationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationOperationResult(document.RootElement, options); + } + + internal static AbstractiveSummarizationOperationResult DeserializeAbstractiveSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AbstractiveSummarizationResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = AbstractiveSummarizationResult.DeserializeAbstractiveSummarizationResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AbstractiveSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.cs new file mode 100644 index 0000000000000..a5498f10b5c62 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the results for an Abstractive Summarization task. + public partial class AbstractiveSummarizationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.AbstractiveSummarizationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal AbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, AbstractiveSummarizationResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public AbstractiveSummarizationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs new file mode 100644 index 0000000000000..addc3686797f7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummarizationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AbstractiveSummarizationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummarizationResult(document.RootElement, options); + } + + internal static AbstractiveSummarizationResult DeserializeAbstractiveSummarizationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummaryDocumentResultWithDetectedLanguage.DeserializeAbstractiveSummaryDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummarizationResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummarizationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummarizationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummarizationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummarizationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummarizationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.cs new file mode 100644 index 0000000000000..60d79600652c6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummarizationResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the pre-built Abstractive Summarization results of each document. + public partial class AbstractiveSummarizationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal AbstractiveSummarizationResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummarizationResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummarizationResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.Serialization.cs new file mode 100644 index 0000000000000..db26d3be20d9d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummary : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support writing '{format}' format."); + } + + writer.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, 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 + } + } + writer.WriteEndObject(); + } + + AbstractiveSummary IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummary(document.RootElement, options); + } + + internal static AbstractiveSummary DeserializeAbstractiveSummary(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + IReadOnlyList contexts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("contexts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SummaryContext.DeserializeSummaryContext(item, options)); + } + contexts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummary(text, contexts ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummary IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAbstractiveSummary(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummary)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AbstractiveSummary FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummary(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.cs new file mode 100644 index 0000000000000..1efea2dd2f479 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummary.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing a single summary with context for given document. + public partial class AbstractiveSummary + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The text of the summary. + /// is null. + internal AbstractiveSummary(string text) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + Contexts = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The text of the summary. + /// The context list of the summary. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummary(string text, IReadOnlyList contexts, IDictionary serializedAdditionalRawData) + { + Text = text; + Contexts = contexts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummary() + { + } + + /// The text of the summary. + public string Text { get; } + /// The context list of the summary. + public IReadOnlyList Contexts { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..b364b9f3895b4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AbstractiveSummaryDocumentResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AbstractiveSummaryDocumentResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("summaries"u8); + writer.WriteStartArray(); + foreach (var item in Summaries) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AbstractiveSummaryDocumentResultWithDetectedLanguage 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(AbstractiveSummaryDocumentResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAbstractiveSummaryDocumentResultWithDetectedLanguage(document.RootElement, options); + } + + internal static AbstractiveSummaryDocumentResultWithDetectedLanguage DeserializeAbstractiveSummaryDocumentResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList summaries = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("summaries"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummary.DeserializeAbstractiveSummary(item, options)); + } + summaries = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AbstractiveSummaryDocumentResultWithDetectedLanguage( + id, + warnings, + statistics, + summaries, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AbstractiveSummaryDocumentResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + AbstractiveSummaryDocumentResultWithDetectedLanguage 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 DeserializeAbstractiveSummaryDocumentResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AbstractiveSummaryDocumentResultWithDetectedLanguage)} 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 AbstractiveSummaryDocumentResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAbstractiveSummaryDocumentResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..e56b0834a574e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AbstractiveSummaryDocumentResultWithDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the Abstractive Summarization result of a single document with detected language. + public partial class AbstractiveSummaryDocumentResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// A list of abstractive summaries. + /// , or is null. + internal AbstractiveSummaryDocumentResultWithDetectedLanguage(string id, IEnumerable warnings, IEnumerable summaries) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(summaries, nameof(summaries)); + + Id = id; + Warnings = warnings.ToList(); + Summaries = summaries.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of abstractive summaries. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal AbstractiveSummaryDocumentResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList summaries, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Summaries = summaries; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AbstractiveSummaryDocumentResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// A list of abstractive summaries. + public IReadOnlyList Summaries { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.Serialization.cs new file mode 100644 index 0000000000000..d454704492327 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AgeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgeMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AgeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AgeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgeMetadata(document.RootElement, options); + } + + internal static AgeMetadata DeserializeAgeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + AgeUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new AgeUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgeMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgeMetadata)} does not support writing '{options.Format}' format."); + } + } + + AgeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AgeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAgeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.cs new file mode 100644 index 0000000000000..74006a8ed9f1e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Age entity Metadata model. + public partial class AgeMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for age. + internal AgeMetadata(double value, AgeUnit unit) + { + MetadataKind = MetadataKind.AgeMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for age. + internal AgeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, AgeUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal AgeMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for age. + public AgeUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeUnit.cs new file mode 100644 index 0000000000000..6a3649f825066 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AgeUnit.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The Age Unit of measurement. + public readonly partial struct AgeUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgeUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string YearValue = "Year"; + private const string MonthValue = "Month"; + private const string WeekValue = "Week"; + private const string DayValue = "Day"; + + /// Unspecified time period. + public static AgeUnit Unspecified { get; } = new AgeUnit(UnspecifiedValue); + /// Time period of a year. + public static AgeUnit Year { get; } = new AgeUnit(YearValue); + /// Time period of a month. + public static AgeUnit Month { get; } = new AgeUnit(MonthValue); + /// Time period of a week. + public static AgeUnit Week { get; } = new AgeUnit(WeekValue); + /// Time period of a day. + public static AgeUnit Day { get; } = new AgeUnit(DayValue); + /// Determines if two values are the same. + public static bool operator ==(AgeUnit left, AgeUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgeUnit left, AgeUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AgeUnit(string value) => new AgeUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgeUnit other && Equals(other); + /// + public bool Equals(AgeUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.Serialization.cs new file mode 100644 index 0000000000000..57bee4da982b2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AllowOverlapEntityPolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AllowOverlapEntityPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAllowOverlapEntityPolicyType(document.RootElement, options); + } + + internal static AllowOverlapEntityPolicyType DeserializeAllowOverlapEntityPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new PolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AllowOverlapEntityPolicyType(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support writing '{options.Format}' format."); + } + } + + AllowOverlapEntityPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAllowOverlapEntityPolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AllowOverlapEntityPolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AllowOverlapEntityPolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAllowOverlapEntityPolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.cs new file mode 100644 index 0000000000000..6f9f9c2f24593 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AllowOverlapEntityPolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the allow overlap policy. Will apply no post processing logic for the entities. Whatever the model predicts is what will be returned to the user. This allows the user to get a full view of every single model's possible values and apply their own custom logic on entity selection. + public partial class AllowOverlapEntityPolicyType : EntityOverlapPolicy + { + /// Initializes a new instance of . + public AllowOverlapEntityPolicyType() + { + PolicyKind = PolicyKind.AllowOverlap; + } + + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal AllowOverlapEntityPolicyType(PolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.Serialization.cs new file mode 100644 index 0000000000000..fade54634c927 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextDynamicClassificationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextDynamicClassificationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextDynamicClassificationResult(document.RootElement, options); + } + + internal static AnalyzeTextDynamicClassificationResult DeserializeAnalyzeTextDynamicClassificationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DynamicClassificationResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = DynamicClassificationResult.DeserializeDynamicClassificationResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextDynamicClassificationResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextDynamicClassificationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextDynamicClassificationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextDynamicClassificationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextDynamicClassificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextDynamicClassificationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.cs new file mode 100644 index 0000000000000..024835522d747 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextDynamicClassificationResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Result for Dynamic Classification task. + public partial class AnalyzeTextDynamicClassificationResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Results for Dynamic Classification task. + /// is null. + internal AnalyzeTextDynamicClassificationResult(DynamicClassificationResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.DynamicClassificationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Results for Dynamic Classification task. + internal AnalyzeTextDynamicClassificationResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, DynamicClassificationResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextDynamicClassificationResult() + { + } + + /// Results for Dynamic Classification task. + public DynamicClassificationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.Serialization.cs new file mode 100644 index 0000000000000..201a64a726658 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextEntitiesResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextEntitiesResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextEntitiesResult(document.RootElement, options); + } + + internal static AnalyzeTextEntitiesResult DeserializeAnalyzeTextEntitiesResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntitiesResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntitiesResult.DeserializeEntitiesResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextEntitiesResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextEntitiesResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextEntitiesResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntitiesResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextEntitiesResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextEntitiesResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.cs new file mode 100644 index 0000000000000..f1a6c56d00dc0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntitiesResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the entity task. + public partial class AnalyzeTextEntitiesResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Results for entity recognition. + /// is null. + internal AnalyzeTextEntitiesResult(EntitiesResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.EntityRecognitionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Results for entity recognition. + internal AnalyzeTextEntitiesResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, EntitiesResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextEntitiesResult() + { + } + + /// Results for entity recognition. + public EntitiesResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.Serialization.cs new file mode 100644 index 0000000000000..6a1b8a392a32d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextEntityLinkingResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextEntityLinkingResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextEntityLinkingResult(document.RootElement, options); + } + + internal static AnalyzeTextEntityLinkingResult DeserializeAnalyzeTextEntityLinkingResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityLinkingResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntityLinkingResult.DeserializeEntityLinkingResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextEntityLinkingResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextEntityLinkingResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextEntityLinkingResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextEntityLinkingResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextEntityLinkingResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextEntityLinkingResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.cs new file mode 100644 index 0000000000000..2fa903a3d8d89 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextEntityLinkingResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text Entity linking task result. + public partial class AnalyzeTextEntityLinkingResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Entity linking result. + /// is null. + internal AnalyzeTextEntityLinkingResult(EntityLinkingResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.EntityLinkingResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Entity linking result. + internal AnalyzeTextEntityLinkingResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, EntityLinkingResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextEntityLinkingResult() + { + } + + /// Entity linking result. + public EntityLinkingResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.Serialization.cs new file mode 100644 index 0000000000000..dacea1161ca67 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support writing '{format}' format."); + } + + writer.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, 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextError(document.RootElement, options); + } + + internal static AnalyzeTextError DeserializeAnalyzeTextError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeTextErrorCode code = default; + string message = default; + string target = default; + IReadOnlyList details = default; + InnerErrorModel innererror = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new AnalyzeTextErrorCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeAnalyzeTextError(item, options)); + } + details = array; + continue; + } + if (property.NameEquals("innererror"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + innererror = InnerErrorModel.DeserializeInnerErrorModel(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextError( + code, + message, + target, + details ?? new ChangeTrackingList(), + innererror, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.cs new file mode 100644 index 0000000000000..bbc09c9287982 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextError.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The error response object returned when the service encounters some errors during processing the request. + public partial class AnalyzeTextError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// A human-readable representation of the error. + /// is null. + internal AnalyzeTextError(AnalyzeTextErrorCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + Details = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// A human-readable representation of the error. + /// The target of the error. + /// An array of details about specific errors that led to this reported error. + /// An object containing more specific information than the current object about the error. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextError(AnalyzeTextErrorCode code, string message, string target, IReadOnlyList details, InnerErrorModel innererror, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Target = target; + Details = details; + Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextError() + { + } + + /// One of a server-defined set of error codes. + public AnalyzeTextErrorCode Code { get; } + /// A human-readable representation of the error. + public string Message { get; } + /// The target of the error. + public string Target { get; } + /// An array of details about specific errors that led to this reported error. + public IReadOnlyList Details { get; } + /// An object containing more specific information than the current object about the error. + public InnerErrorModel Innererror { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextErrorCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextErrorCode.cs new file mode 100644 index 0000000000000..2298da29487d1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextErrorCode.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Human-readable error code. + public readonly partial struct AnalyzeTextErrorCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextErrorCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidRequestValue = "InvalidRequest"; + private const string InvalidArgumentValue = "InvalidArgument"; + private const string UnauthorizedValue = "Unauthorized"; + private const string ForbiddenValue = "Forbidden"; + private const string NotFoundValue = "NotFound"; + private const string ProjectNotFoundValue = "ProjectNotFound"; + private const string OperationNotFoundValue = "OperationNotFound"; + private const string AzureCognitiveSearchNotFoundValue = "AzureCognitiveSearchNotFound"; + private const string AzureCognitiveSearchIndexNotFoundValue = "AzureCognitiveSearchIndexNotFound"; + private const string TooManyRequestsValue = "TooManyRequests"; + private const string AzureCognitiveSearchThrottlingValue = "AzureCognitiveSearchThrottling"; + private const string AzureCognitiveSearchIndexLimitReachedValue = "AzureCognitiveSearchIndexLimitReached"; + private const string InternalServerErrorValue = "InternalServerError"; + private const string ServiceUnavailableValue = "ServiceUnavailable"; + private const string TimeoutValue = "Timeout"; + private const string QuotaExceededValue = "QuotaExceeded"; + private const string ConflictValue = "Conflict"; + private const string WarningValue = "Warning"; + + /// Invalid request error. + public static AnalyzeTextErrorCode InvalidRequest { get; } = new AnalyzeTextErrorCode(InvalidRequestValue); + /// Invalid argument error. + public static AnalyzeTextErrorCode InvalidArgument { get; } = new AnalyzeTextErrorCode(InvalidArgumentValue); + /// Unauthorized access error. + public static AnalyzeTextErrorCode Unauthorized { get; } = new AnalyzeTextErrorCode(UnauthorizedValue); + /// Forbidden access error. + public static AnalyzeTextErrorCode Forbidden { get; } = new AnalyzeTextErrorCode(ForbiddenValue); + /// Not found error. + public static AnalyzeTextErrorCode NotFound { get; } = new AnalyzeTextErrorCode(NotFoundValue); + /// Project not found error. + public static AnalyzeTextErrorCode ProjectNotFound { get; } = new AnalyzeTextErrorCode(ProjectNotFoundValue); + /// Operation not found error. + public static AnalyzeTextErrorCode OperationNotFound { get; } = new AnalyzeTextErrorCode(OperationNotFoundValue); + /// Azure Cognitive Search not found error. + public static AnalyzeTextErrorCode AzureCognitiveSearchNotFound { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchNotFoundValue); + /// Azure Cognitive Search index not found error. + public static AnalyzeTextErrorCode AzureCognitiveSearchIndexNotFound { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchIndexNotFoundValue); + /// Too many requests error. + public static AnalyzeTextErrorCode TooManyRequests { get; } = new AnalyzeTextErrorCode(TooManyRequestsValue); + /// Azure Cognitive Search throttling error. + public static AnalyzeTextErrorCode AzureCognitiveSearchThrottling { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchThrottlingValue); + /// Azure Cognitive Search index limit reached error. + public static AnalyzeTextErrorCode AzureCognitiveSearchIndexLimitReached { get; } = new AnalyzeTextErrorCode(AzureCognitiveSearchIndexLimitReachedValue); + /// Internal server error. + public static AnalyzeTextErrorCode InternalServerError { get; } = new AnalyzeTextErrorCode(InternalServerErrorValue); + /// Service unavailable error. + public static AnalyzeTextErrorCode ServiceUnavailable { get; } = new AnalyzeTextErrorCode(ServiceUnavailableValue); + /// Timeout error. + public static AnalyzeTextErrorCode Timeout { get; } = new AnalyzeTextErrorCode(TimeoutValue); + /// Quota exceeded error. + public static AnalyzeTextErrorCode QuotaExceeded { get; } = new AnalyzeTextErrorCode(QuotaExceededValue); + /// Conflict error. + public static AnalyzeTextErrorCode Conflict { get; } = new AnalyzeTextErrorCode(ConflictValue); + /// Warning error. + public static AnalyzeTextErrorCode Warning { get; } = new AnalyzeTextErrorCode(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextErrorCode left, AnalyzeTextErrorCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextErrorCode left, AnalyzeTextErrorCode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeTextErrorCode(string value) => new AnalyzeTextErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextErrorCode other && Equals(other); + /// + public bool Equals(AnalyzeTextErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.Serialization.cs new file mode 100644 index 0000000000000..d743e038ae8c4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextInput))] + public partial class AnalyzeTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + + internal static AnalyzeTextInput DeserializeAnalyzeTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DynamicClassification": return TextDynamicClassificationInput.DeserializeTextDynamicClassificationInput(element, options); + case "EntityLinking": return TextEntityLinkingInput.DeserializeTextEntityLinkingInput(element, options); + case "EntityRecognition": return TextEntityRecognitionInput.DeserializeTextEntityRecognitionInput(element, options); + case "KeyPhraseExtraction": return TextKeyPhraseExtractionInput.DeserializeTextKeyPhraseExtractionInput(element, options); + case "LanguageDetection": return TextLanguageDetectionInput.DeserializeTextLanguageDetectionInput(element, options); + case "PiiEntityRecognition": return TextPiiEntitiesRecognitionInput.DeserializeTextPiiEntitiesRecognitionInput(element, options); + case "SentimentAnalysis": return TextSentimentAnalysisInput.DeserializeTextSentimentAnalysisInput(element, options); + } + } + return UnknownAnalyzeTextInput.DeserializeUnknownAnalyzeTextInput(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.cs new file mode 100644 index 0000000000000..8dab7bebb56f5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInput.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// Collection of documents to analyze and a single task to execute. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public abstract partial class AnalyzeTextInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AnalyzeTextInput() + { + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The kind of task to perform. + internal AnalyzeTextInputKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInputKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInputKind.cs new file mode 100644 index 0000000000000..63f642b30e0c0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextInputKind.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The kind of the analyze-text tasks supported. + internal readonly partial struct AnalyzeTextInputKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextInputKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisValue = "SentimentAnalysis"; + private const string EntityRecognitionValue = "EntityRecognition"; + private const string PiiEntityRecognitionValue = "PiiEntityRecognition"; + private const string KeyPhraseExtractionValue = "KeyPhraseExtraction"; + private const string LanguageDetectionValue = "LanguageDetection"; + private const string EntityLinkingValue = "EntityLinking"; + private const string DynamicClassificationValue = "DynamicClassification"; + + /// Sentiment analysis task. + public static AnalyzeTextInputKind SentimentAnalysis { get; } = new AnalyzeTextInputKind(SentimentAnalysisValue); + /// Entity recognition task. + public static AnalyzeTextInputKind EntityRecognition { get; } = new AnalyzeTextInputKind(EntityRecognitionValue); + /// PII entity recognition task. + public static AnalyzeTextInputKind PiiEntityRecognition { get; } = new AnalyzeTextInputKind(PiiEntityRecognitionValue); + /// Key phrase extraction task. + public static AnalyzeTextInputKind KeyPhraseExtraction { get; } = new AnalyzeTextInputKind(KeyPhraseExtractionValue); + /// Language detection task. + public static AnalyzeTextInputKind LanguageDetection { get; } = new AnalyzeTextInputKind(LanguageDetectionValue); + /// Entity linking task. + public static AnalyzeTextInputKind EntityLinking { get; } = new AnalyzeTextInputKind(EntityLinkingValue); + /// Dynamic classification task. + public static AnalyzeTextInputKind DynamicClassification { get; } = new AnalyzeTextInputKind(DynamicClassificationValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextInputKind left, AnalyzeTextInputKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextInputKind left, AnalyzeTextInputKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeTextInputKind(string value) => new AnalyzeTextInputKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextInputKind other && Equals(other); + /// + public bool Equals(AnalyzeTextInputKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.Serialization.cs new file mode 100644 index 0000000000000..599c59753ee87 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextKeyPhraseResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextKeyPhraseResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextKeyPhraseResult(document.RootElement, options); + } + + internal static AnalyzeTextKeyPhraseResult DeserializeAnalyzeTextKeyPhraseResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyPhraseResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = KeyPhraseResult.DeserializeKeyPhraseResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextKeyPhraseResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextKeyPhraseResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextKeyPhraseResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextKeyPhraseResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextKeyPhraseResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextKeyPhraseResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.cs new file mode 100644 index 0000000000000..5e32e93c443c2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextKeyPhraseResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text KeyPhraseExtraction task result. + public partial class AnalyzeTextKeyPhraseResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The list of Key phrase extraction results. + /// is null. + internal AnalyzeTextKeyPhraseResult(KeyPhraseResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.KeyPhraseExtractionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// The list of Key phrase extraction results. + internal AnalyzeTextKeyPhraseResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, KeyPhraseResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextKeyPhraseResult() + { + } + + /// The list of Key phrase extraction results. + public KeyPhraseResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.Serialization.cs new file mode 100644 index 0000000000000..fb6a942aba321 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextLanguageDetectionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextLanguageDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextLanguageDetectionResult(document.RootElement, options); + } + + internal static AnalyzeTextLanguageDetectionResult DeserializeAnalyzeTextLanguageDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LanguageDetectionResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = LanguageDetectionResult.DeserializeLanguageDetectionResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextLanguageDetectionResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextLanguageDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextLanguageDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextLanguageDetectionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextLanguageDetectionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextLanguageDetectionResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.cs new file mode 100644 index 0000000000000..712e62b41f68b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextLanguageDetectionResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the language detection task result for the request. + public partial class AnalyzeTextLanguageDetectionResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// Contains the language detection results. + /// is null. + internal AnalyzeTextLanguageDetectionResult(LanguageDetectionResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.LanguageDetectionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// Contains the language detection results. + internal AnalyzeTextLanguageDetectionResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, LanguageDetectionResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextLanguageDetectionResult() + { + } + + /// Contains the language detection results. + public LanguageDetectionResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.Serialization.cs new file mode 100644 index 0000000000000..51ebfabf8e523 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.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.Text.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextOperationAction))] + public partial class AnalyzeTextOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + + internal static AnalyzeTextOperationAction DeserializeAnalyzeTextOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AbstractiveSummarization": return AbstractiveSummarizationOperationAction.DeserializeAbstractiveSummarizationOperationAction(element, options); + case "CustomAbstractiveSummarization": return CustomAbstractiveSummarizationOperationAction.DeserializeCustomAbstractiveSummarizationOperationAction(element, options); + case "CustomEntityRecognition": return CustomEntitiesOperationAction.DeserializeCustomEntitiesOperationAction(element, options); + case "CustomHealthcare": return CustomHealthcareOperationAction.DeserializeCustomHealthcareOperationAction(element, options); + case "CustomMultiLabelClassification": return CustomMultiLabelClassificationOperationAction.DeserializeCustomMultiLabelClassificationOperationAction(element, options); + case "CustomSentimentAnalysis": return CustomSentimentAnalysisOperationAction.DeserializeCustomSentimentAnalysisOperationAction(element, options); + case "CustomSingleLabelClassification": return CustomSingleLabelClassificationOperationAction.DeserializeCustomSingleLabelClassificationOperationAction(element, options); + case "EntityLinking": return EntityLinkingOperationAction.DeserializeEntityLinkingOperationAction(element, options); + case "EntityRecognition": return EntitiesOperationAction.DeserializeEntitiesOperationAction(element, options); + case "ExtractiveSummarization": return ExtractiveSummarizationOperationAction.DeserializeExtractiveSummarizationOperationAction(element, options); + case "Healthcare": return HealthcareOperationAction.DeserializeHealthcareOperationAction(element, options); + case "KeyPhraseExtraction": return KeyPhraseOperationAction.DeserializeKeyPhraseOperationAction(element, options); + case "PiiEntityRecognition": return PiiOperationAction.DeserializePiiOperationAction(element, options); + case "SentimentAnalysis": return SentimentAnalysisOperationAction.DeserializeSentimentAnalysisOperationAction(element, options); + } + } + return UnknownAnalyzeTextOperationAction.DeserializeUnknownAnalyzeTextOperationAction(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationAction(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.cs new file mode 100644 index 0000000000000..2a0a3c0cffff5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationAction.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// The long running task to be performed by the service on the input documents. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public abstract partial class AnalyzeTextOperationAction + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AnalyzeTextOperationAction() + { + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData) + { + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// task name. + public string Name { get; set; } + /// The kind of task to perform. + internal AnalyzeTextOperationActionKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationActionKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationActionKind.cs new file mode 100644 index 0000000000000..4921ebafe5692 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationActionKind.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The kind of the long running analyze text tasks supported. + internal readonly partial struct AnalyzeTextOperationActionKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextOperationActionKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisValue = "SentimentAnalysis"; + private const string EntityRecognitionValue = "EntityRecognition"; + private const string PiiEntityRecognitionValue = "PiiEntityRecognition"; + private const string KeyPhraseExtractionValue = "KeyPhraseExtraction"; + private const string EntityLinkingValue = "EntityLinking"; + private const string HealthcareValue = "Healthcare"; + private const string CustomEntityRecognitionValue = "CustomEntityRecognition"; + private const string CustomSingleLabelClassificationValue = "CustomSingleLabelClassification"; + private const string CustomMultiLabelClassificationValue = "CustomMultiLabelClassification"; + private const string ExtractiveSummarizationValue = "ExtractiveSummarization"; + private const string AbstractiveSummarizationValue = "AbstractiveSummarization"; + private const string CustomHealthcareValue = "CustomHealthcare"; + private const string CustomSentimentAnalysisValue = "CustomSentimentAnalysis"; + private const string CustomAbstractiveSummarizationValue = "CustomAbstractiveSummarization"; + + /// Sentiment analysis task. + public static AnalyzeTextOperationActionKind SentimentAnalysis { get; } = new AnalyzeTextOperationActionKind(SentimentAnalysisValue); + /// Entity recognition task. + public static AnalyzeTextOperationActionKind EntityRecognition { get; } = new AnalyzeTextOperationActionKind(EntityRecognitionValue); + /// PII entity recognition task. + public static AnalyzeTextOperationActionKind PiiEntityRecognition { get; } = new AnalyzeTextOperationActionKind(PiiEntityRecognitionValue); + /// Key phrase extraction task. + public static AnalyzeTextOperationActionKind KeyPhraseExtraction { get; } = new AnalyzeTextOperationActionKind(KeyPhraseExtractionValue); + /// Entity linking task. + public static AnalyzeTextOperationActionKind EntityLinking { get; } = new AnalyzeTextOperationActionKind(EntityLinkingValue); + /// Healthcare task. + public static AnalyzeTextOperationActionKind Healthcare { get; } = new AnalyzeTextOperationActionKind(HealthcareValue); + /// Custom entity recognition task. + public static AnalyzeTextOperationActionKind CustomEntityRecognition { get; } = new AnalyzeTextOperationActionKind(CustomEntityRecognitionValue); + /// Custom single label classification task. + public static AnalyzeTextOperationActionKind CustomSingleLabelClassification { get; } = new AnalyzeTextOperationActionKind(CustomSingleLabelClassificationValue); + /// Custom multi label classification task. + public static AnalyzeTextOperationActionKind CustomMultiLabelClassification { get; } = new AnalyzeTextOperationActionKind(CustomMultiLabelClassificationValue); + /// Extractive summarization task. + public static AnalyzeTextOperationActionKind ExtractiveSummarization { get; } = new AnalyzeTextOperationActionKind(ExtractiveSummarizationValue); + /// Abstractive summarization task. + public static AnalyzeTextOperationActionKind AbstractiveSummarization { get; } = new AnalyzeTextOperationActionKind(AbstractiveSummarizationValue); + /// Custom healthcare task. + public static AnalyzeTextOperationActionKind CustomHealthcare { get; } = new AnalyzeTextOperationActionKind(CustomHealthcareValue); + /// Custom sentiment analysis task. + public static AnalyzeTextOperationActionKind CustomSentimentAnalysis { get; } = new AnalyzeTextOperationActionKind(CustomSentimentAnalysisValue); + /// Custom abstractive summarization task. + public static AnalyzeTextOperationActionKind CustomAbstractiveSummarization { get; } = new AnalyzeTextOperationActionKind(CustomAbstractiveSummarizationValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextOperationActionKind left, AnalyzeTextOperationActionKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextOperationActionKind left, AnalyzeTextOperationActionKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeTextOperationActionKind(string value) => new AnalyzeTextOperationActionKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextOperationActionKind other && Equals(other); + /// + public bool Equals(AnalyzeTextOperationActionKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.Serialization.cs new file mode 100644 index 0000000000000..e356e42587ab9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class AnalyzeTextOperationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + writer.WritePropertyName("tasks"u8); + writer.WriteStartArray(); + foreach (var item in Actions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DefaultLanguage)) + { + writer.WritePropertyName("defaultLanguage"u8); + writer.WriteStringValue(DefaultLanguage); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeTextOperationInput 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(AnalyzeTextOperationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationInput(document.RootElement, options); + } + + internal static AnalyzeTextOperationInput DeserializeAnalyzeTextOperationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + MultiLanguageTextInput 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 = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("tasks"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeTextOperationAction.DeserializeAnalyzeTextOperationAction(item, options)); + } + tasks = array; + continue; + } + if (property.NameEquals("defaultLanguage"u8)) + { + defaultLanguage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextOperationInput(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(AnalyzeTextOperationInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationInput 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 DeserializeAnalyzeTextOperationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationInput)} 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 AnalyzeTextOperationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.cs new file mode 100644 index 0000000000000..597036e79849e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationInput.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// The input object for the analyze text LRO. + internal partial class AnalyzeTextOperationInput + { + /// + /// 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 AnalyzeTextOperationInput(MultiLanguageTextInput textInput, IEnumerable actions) + { + Argument.AssertNotNull(textInput, nameof(textInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + TextInput = textInput; + Actions = actions.ToList(); + } + + /// Initializes a new instance of . + /// Name for the task. + /// Contains the input to be analyzed. + /// + /// List of tasks to be performed as part of the LRO. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// Default language to use for records requesting automatic language detection. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationInput(string displayName, MultiLanguageTextInput textInput, IList actions, string defaultLanguage, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + TextInput = textInput; + Actions = actions; + DefaultLanguage = defaultLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextOperationInput() + { + } + + /// Name for the task. + public string DisplayName { get; set; } + /// Contains the input to be analyzed. + public MultiLanguageTextInput TextInput { get; } + /// + /// List of tasks to be performed as part of the LRO. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public IList Actions { get; } + /// Default language to use for records requesting automatic language detection. + public string DefaultLanguage { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.Serialization.cs new file mode 100644 index 0000000000000..358ee3e281718 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextOperationResult))] + public partial class AnalyzeTextOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeTextOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + + internal static AnalyzeTextOperationResult DeserializeAnalyzeTextOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AbstractiveSummarizationLROResults": return AbstractiveSummarizationOperationResult.DeserializeAbstractiveSummarizationOperationResult(element, options); + case "CustomAbstractiveSummarizationLROResults": return CustomAbstractiveSummarizationOperationResult.DeserializeCustomAbstractiveSummarizationOperationResult(element, options); + case "CustomEntityRecognitionLROResults": return CustomEntityRecognitionOperationResult.DeserializeCustomEntityRecognitionOperationResult(element, options); + case "CustomHealthcareLROResults": return CustomHealthcareOperationResult.DeserializeCustomHealthcareOperationResult(element, options); + case "CustomMultiLabelClassificationLROResults": return CustomMultiLabelClassificationOperationResult.DeserializeCustomMultiLabelClassificationOperationResult(element, options); + case "CustomSentimentAnalysisLROResults": return CustomSentimentAnalysisOperationResult.DeserializeCustomSentimentAnalysisOperationResult(element, options); + case "CustomSingleLabelClassificationLROResults": return CustomSingleLabelClassificationOperationResult.DeserializeCustomSingleLabelClassificationOperationResult(element, options); + case "EntityLinkingLROResults": return EntityLinkingOperationResult.DeserializeEntityLinkingOperationResult(element, options); + case "EntityRecognitionLROResults": return EntityRecognitionOperationResult.DeserializeEntityRecognitionOperationResult(element, options); + case "ExtractiveSummarizationLROResults": return ExtractiveSummarizationOperationResult.DeserializeExtractiveSummarizationOperationResult(element, options); + case "HealthcareLROResults": return HealthcareOperationResult.DeserializeHealthcareOperationResult(element, options); + case "KeyPhraseExtractionLROResults": return KeyPhraseExtractionOperationResult.DeserializeKeyPhraseExtractionOperationResult(element, options); + case "PiiEntityRecognitionLROResults": return PiiEntityRecognitionOperationResult.DeserializePiiEntityRecognitionOperationResult(element, options); + case "SentimentAnalysisLROResults": return SentimentOperationResult.DeserializeSentimentOperationResult(element, options); + } + } + return UnknownAnalyzeTextOperationResult.DeserializeUnknownAnalyzeTextOperationResult(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.cs new file mode 100644 index 0000000000000..0cdbda2d40c30 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResult.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// Contains the AnalyzeText long running operation result object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public abstract partial class AnalyzeTextOperationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + protected AnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status) + { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData) + { + LastUpdateDateTime = lastUpdateDateTime; + Status = status; + Name = name; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextOperationResult() + { + } + + /// The last updated time in UTC for the task. + public DateTimeOffset LastUpdateDateTime { get; } + /// The status of the task at the mentioned last update time. + public TextActionState Status { get; } + /// task name. + public string Name { get; } + /// Kind of the task. + internal AnalyzeTextOperationResultsKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResultsKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResultsKind.cs new file mode 100644 index 0000000000000..a28f9e9bbd2bd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationResultsKind.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The kind of the response object returned by the analyze-text long running task. + internal readonly partial struct AnalyzeTextOperationResultsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextOperationResultsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisOperationResultsValue = "SentimentAnalysisLROResults"; + private const string EntityRecognitionOperationResultsValue = "EntityRecognitionLROResults"; + private const string PiiEntityRecognitionOperationResultsValue = "PiiEntityRecognitionLROResults"; + private const string KeyPhraseExtractionOperationResultsValue = "KeyPhraseExtractionLROResults"; + private const string EntityLinkingOperationResultsValue = "EntityLinkingLROResults"; + private const string HealthcareOperationResultsValue = "HealthcareLROResults"; + private const string CustomEntityRecognitionOperationResultsValue = "CustomEntityRecognitionLROResults"; + private const string CustomSingleLabelClassificationOperationResultsValue = "CustomSingleLabelClassificationLROResults"; + private const string CustomMultiLabelClassificationOperationResultsValue = "CustomMultiLabelClassificationLROResults"; + private const string ExtractiveSummarizationOperationResultsValue = "ExtractiveSummarizationLROResults"; + private const string AbstractiveSummarizationOperationResultsValue = "AbstractiveSummarizationLROResults"; + private const string CustomHealthcareOperationResultsValue = "CustomHealthcareLROResults"; + private const string CustomSentimentAnalysisOperationResultsValue = "CustomSentimentAnalysisLROResults"; + private const string CustomAbstractiveSummarizationOperationResultsValue = "CustomAbstractiveSummarizationLROResults"; + + /// Sentiment analysis LRO results. + public static AnalyzeTextOperationResultsKind SentimentAnalysisOperationResults { get; } = new AnalyzeTextOperationResultsKind(SentimentAnalysisOperationResultsValue); + /// Entity recognition LRO results. + public static AnalyzeTextOperationResultsKind EntityRecognitionOperationResults { get; } = new AnalyzeTextOperationResultsKind(EntityRecognitionOperationResultsValue); + /// PII entity recognition LRO results. + public static AnalyzeTextOperationResultsKind PiiEntityRecognitionOperationResults { get; } = new AnalyzeTextOperationResultsKind(PiiEntityRecognitionOperationResultsValue); + /// Key phrase extraction LRO results. + public static AnalyzeTextOperationResultsKind KeyPhraseExtractionOperationResults { get; } = new AnalyzeTextOperationResultsKind(KeyPhraseExtractionOperationResultsValue); + /// Entity linking LRO results. + public static AnalyzeTextOperationResultsKind EntityLinkingOperationResults { get; } = new AnalyzeTextOperationResultsKind(EntityLinkingOperationResultsValue); + /// Healthcare LRO results. + public static AnalyzeTextOperationResultsKind HealthcareOperationResults { get; } = new AnalyzeTextOperationResultsKind(HealthcareOperationResultsValue); + /// Custom entity recognition LRO results. + public static AnalyzeTextOperationResultsKind CustomEntityRecognitionOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomEntityRecognitionOperationResultsValue); + /// Custom single label classification LRO results. + public static AnalyzeTextOperationResultsKind CustomSingleLabelClassificationOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomSingleLabelClassificationOperationResultsValue); + /// Custom multi label classification LRO results. + public static AnalyzeTextOperationResultsKind CustomMultiLabelClassificationOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomMultiLabelClassificationOperationResultsValue); + /// Extractive summarization LRO results. + public static AnalyzeTextOperationResultsKind ExtractiveSummarizationOperationResults { get; } = new AnalyzeTextOperationResultsKind(ExtractiveSummarizationOperationResultsValue); + /// Abstractive summarization LRO results. + public static AnalyzeTextOperationResultsKind AbstractiveSummarizationOperationResults { get; } = new AnalyzeTextOperationResultsKind(AbstractiveSummarizationOperationResultsValue); + /// Custom healthcare LRO results. + public static AnalyzeTextOperationResultsKind CustomHealthcareOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomHealthcareOperationResultsValue); + /// Custom sentiment analysis LRO results. + public static AnalyzeTextOperationResultsKind CustomSentimentAnalysisOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomSentimentAnalysisOperationResultsValue); + /// Custom abstractive summarization LRO results. + public static AnalyzeTextOperationResultsKind CustomAbstractiveSummarizationOperationResults { get; } = new AnalyzeTextOperationResultsKind(CustomAbstractiveSummarizationOperationResultsValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextOperationResultsKind left, AnalyzeTextOperationResultsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextOperationResultsKind left, AnalyzeTextOperationResultsKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeTextOperationResultsKind(string value) => new AnalyzeTextOperationResultsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextOperationResultsKind other && Equals(other); + /// + public bool Equals(AnalyzeTextOperationResultsKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.Serialization.cs new file mode 100644 index 0000000000000..5588a86a6e83c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.Serialization.cs @@ -0,0 +1,258 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextOperationState : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + writer.WritePropertyName("createdDateTime"u8); + writer.WriteStringValue(CreatedAt, "O"); + if (Optional.IsDefined(ExpiresOn)) + { + writer.WritePropertyName("expirationDateTime"u8); + writer.WriteStringValue(ExpiresOn.Value, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("jobId"u8); + writer.WriteStringValue(JobId); + } + writer.WritePropertyName("lastUpdatedDateTime"u8); + writer.WriteStringValue(LastUpdatedAt, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WritePropertyName("tasks"u8); + writer.WriteObjectValue(Actions, options); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeTextOperationState IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationState(document.RootElement, options); + } + + internal static AnalyzeTextOperationState DeserializeAnalyzeTextOperationState(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string displayName = default; + DateTimeOffset createdDateTime = default; + DateTimeOffset? expirationDateTime = default; + Guid jobId = default; + DateTimeOffset lastUpdatedDateTime = default; + TextActionState status = default; + IReadOnlyList errors = default; + string nextLink = default; + TextActions tasks = default; + RequestStatistics statistics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdDateTime"u8)) + { + createdDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("expirationDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expirationDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("jobId"u8)) + { + jobId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("lastUpdatedDateTime"u8)) + { + lastUpdatedDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeTextError.DeserializeAnalyzeTextError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("tasks"u8)) + { + tasks = TextActions.DeserializeTextActions(property.Value, options); + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextOperationState( + displayName, + createdDateTime, + expirationDateTime, + jobId, + lastUpdatedDateTime, + status, + errors ?? new ChangeTrackingList(), + nextLink, + tasks, + statistics, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationState IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationState(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationState)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextOperationState FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextOperationState(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.cs new file mode 100644 index 0000000000000..e950edab16f2d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextOperationState.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The object containing the analyze job LRO job state. + public partial class AnalyzeTextOperationState + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Date and time job created. + /// last updated date and time. + /// status. + /// List of tasks. + /// is null. + internal AnalyzeTextOperationState(DateTimeOffset createdAt, DateTimeOffset lastUpdatedAt, TextActionState status, TextActions actions) + { + Argument.AssertNotNull(actions, nameof(actions)); + + CreatedAt = createdAt; + LastUpdatedAt = lastUpdatedAt; + Status = status; + Errors = new ChangeTrackingList(); + Actions = actions; + } + + /// Initializes a new instance of . + /// display name. + /// Date and time job created. + /// Date and time job expires. + /// job ID. + /// last updated date and time. + /// status. + /// errors. + /// next link. + /// List of tasks. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextOperationState(string displayName, DateTimeOffset createdAt, DateTimeOffset? expiresOn, Guid jobId, DateTimeOffset lastUpdatedAt, TextActionState status, IReadOnlyList errors, string nextLink, TextActions actions, RequestStatistics statistics, IDictionary serializedAdditionalRawData) + { + DisplayName = displayName; + CreatedAt = createdAt; + ExpiresOn = expiresOn; + JobId = jobId; + LastUpdatedAt = lastUpdatedAt; + Status = status; + Errors = errors; + NextLink = nextLink; + Actions = actions; + Statistics = statistics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextOperationState() + { + } + + /// display name. + public string DisplayName { get; } + /// Date and time job created. + public DateTimeOffset CreatedAt { get; } + /// Date and time job expires. + public DateTimeOffset? ExpiresOn { get; } + /// job ID. + public Guid JobId { get; } + /// last updated date and time. + public DateTimeOffset LastUpdatedAt { get; } + /// status. + public TextActionState Status { get; } + /// errors. + public IReadOnlyList Errors { get; } + /// next link. + public string NextLink { get; } + /// List of tasks. + public TextActions Actions { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.Serialization.cs new file mode 100644 index 0000000000000..b26382f7dd711 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextPiiResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextPiiResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextPiiResult(document.RootElement, options); + } + + internal static AnalyzeTextPiiResult DeserializeAnalyzeTextPiiResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = PiiResult.DeserializePiiResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextPiiResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextPiiResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextPiiResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextPiiResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextPiiResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextPiiResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.cs new file mode 100644 index 0000000000000..74c044ca57b06 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextPiiResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text PIIEntityRecognition LRO task. + public partial class AnalyzeTextPiiResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The list of pii results. + /// is null. + internal AnalyzeTextPiiResult(PiiResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.PiiEntityRecognitionResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// The list of pii results. + internal AnalyzeTextPiiResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, PiiResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextPiiResult() + { + } + + /// The list of pii results. + public PiiResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.Serialization.cs new file mode 100644 index 0000000000000..0724d13049481 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.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.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + [PersistableModelProxy(typeof(UnknownAnalyzeTextResult))] + public partial class AnalyzeTextResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + + internal static AnalyzeTextResult DeserializeAnalyzeTextResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "DynamicClassificationResults": return AnalyzeTextDynamicClassificationResult.DeserializeAnalyzeTextDynamicClassificationResult(element, options); + case "EntityLinkingResults": return AnalyzeTextEntityLinkingResult.DeserializeAnalyzeTextEntityLinkingResult(element, options); + case "EntityRecognitionResults": return AnalyzeTextEntitiesResult.DeserializeAnalyzeTextEntitiesResult(element, options); + case "KeyPhraseExtractionResults": return AnalyzeTextKeyPhraseResult.DeserializeAnalyzeTextKeyPhraseResult(element, options); + case "LanguageDetectionResults": return AnalyzeTextLanguageDetectionResult.DeserializeAnalyzeTextLanguageDetectionResult(element, options); + case "PiiEntityRecognitionResults": return AnalyzeTextPiiResult.DeserializeAnalyzeTextPiiResult(element, options); + case "SentimentAnalysisResults": return AnalyzeTextSentimentResult.DeserializeAnalyzeTextSentimentResult(element, options); + } + } + return UnknownAnalyzeTextResult.DeserializeUnknownAnalyzeTextResult(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AnalyzeTextResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.cs new file mode 100644 index 0000000000000..457bbe7bf7129 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResult.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// The result object for the analyze task. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , and . + /// + public abstract partial class AnalyzeTextResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected AnalyzeTextResult() + { + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + internal AnalyzeTextResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The kind of task result. + internal AnalyzeTextResultsKind Kind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResultsKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResultsKind.cs new file mode 100644 index 0000000000000..a710f262a2fde --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextResultsKind.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The kind of the response object returned by the analyze-text task. + internal readonly partial struct AnalyzeTextResultsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AnalyzeTextResultsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SentimentAnalysisResultsValue = "SentimentAnalysisResults"; + private const string EntityRecognitionResultsValue = "EntityRecognitionResults"; + private const string PiiEntityRecognitionResultsValue = "PiiEntityRecognitionResults"; + private const string KeyPhraseExtractionResultsValue = "KeyPhraseExtractionResults"; + private const string LanguageDetectionResultsValue = "LanguageDetectionResults"; + private const string EntityLinkingResultsValue = "EntityLinkingResults"; + private const string DynamicClassificationResultsValue = "DynamicClassificationResults"; + + /// Sentiment analysis results. + public static AnalyzeTextResultsKind SentimentAnalysisResults { get; } = new AnalyzeTextResultsKind(SentimentAnalysisResultsValue); + /// Entity recognition results. + public static AnalyzeTextResultsKind EntityRecognitionResults { get; } = new AnalyzeTextResultsKind(EntityRecognitionResultsValue); + /// PII entity recognition results. + public static AnalyzeTextResultsKind PiiEntityRecognitionResults { get; } = new AnalyzeTextResultsKind(PiiEntityRecognitionResultsValue); + /// Key phrase extraction results. + public static AnalyzeTextResultsKind KeyPhraseExtractionResults { get; } = new AnalyzeTextResultsKind(KeyPhraseExtractionResultsValue); + /// Language detection results. + public static AnalyzeTextResultsKind LanguageDetectionResults { get; } = new AnalyzeTextResultsKind(LanguageDetectionResultsValue); + /// Entity linking results. + public static AnalyzeTextResultsKind EntityLinkingResults { get; } = new AnalyzeTextResultsKind(EntityLinkingResultsValue); + /// Dynamic classification results. + public static AnalyzeTextResultsKind DynamicClassificationResults { get; } = new AnalyzeTextResultsKind(DynamicClassificationResultsValue); + /// Determines if two values are the same. + public static bool operator ==(AnalyzeTextResultsKind left, AnalyzeTextResultsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AnalyzeTextResultsKind left, AnalyzeTextResultsKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AnalyzeTextResultsKind(string value) => new AnalyzeTextResultsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AnalyzeTextResultsKind other && Equals(other); + /// + public bool Equals(AnalyzeTextResultsKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.Serialization.cs new file mode 100644 index 0000000000000..e3ca2dd7c3581 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AnalyzeTextSentimentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextSentimentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextSentimentResult(document.RootElement, options); + } + + internal static AnalyzeTextSentimentResult DeserializeAnalyzeTextSentimentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SentimentResult results = default; + AnalyzeTextResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = SentimentResult.DeserializeSentimentResult(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AnalyzeTextSentimentResult(kind, serializedAdditionalRawData, results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextSentimentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextSentimentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextSentimentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AnalyzeTextSentimentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAnalyzeTextSentimentResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.cs new file mode 100644 index 0000000000000..256562aa940d7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AnalyzeTextSentimentResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text SentimentAnalysis LRO task result. + public partial class AnalyzeTextSentimentResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The sentiment analysis results. + /// is null. + internal AnalyzeTextSentimentResult(SentimentResult results) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextResultsKind.SentimentAnalysisResults; + Results = results; + } + + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + /// The sentiment analysis results. + internal AnalyzeTextSentimentResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData, SentimentResult results) : base(kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal AnalyzeTextSentimentResult() + { + } + + /// The sentiment analysis results. + public SentimentResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.Serialization.cs new file mode 100644 index 0000000000000..d52a1e4cea380 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class AreaMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AreaMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AreaMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AreaMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAreaMetadata(document.RootElement, options); + } + + internal static AreaMetadata DeserializeAreaMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + AreaUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new AreaUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AreaMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AreaMetadata)} does not support writing '{options.Format}' format."); + } + } + + AreaMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAreaMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AreaMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AreaMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAreaMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.cs new file mode 100644 index 0000000000000..1993c765bb82f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Area entity Metadata model. + public partial class AreaMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for area. + internal AreaMetadata(double value, AreaUnit unit) + { + MetadataKind = MetadataKind.AreaMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for area. + internal AreaMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, AreaUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal AreaMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for area. + public AreaUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaUnit.cs new file mode 100644 index 0000000000000..9ba1309b9515a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/AreaUnit.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The area unit of measurement. + public readonly partial struct AreaUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AreaUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string SquareKilometerValue = "SquareKilometer"; + private const string SquareHectometerValue = "SquareHectometer"; + private const string SquareDecameterValue = "SquareDecameter"; + private const string SquareDecimeterValue = "SquareDecimeter"; + private const string SquareMeterValue = "SquareMeter"; + private const string SquareCentimeterValue = "SquareCentimeter"; + private const string SquareMillimeterValue = "SquareMillimeter"; + private const string SquareInchValue = "SquareInch"; + private const string SquareFootValue = "SquareFoot"; + private const string SquareMileValue = "SquareMile"; + private const string SquareYardValue = "SquareYard"; + private const string AcreValue = "Acre"; + + /// Unspecified area unit. + public static AreaUnit Unspecified { get; } = new AreaUnit(UnspecifiedValue); + /// Area unit in square kilometers. + public static AreaUnit SquareKilometer { get; } = new AreaUnit(SquareKilometerValue); + /// Area unit in square hectometers. + public static AreaUnit SquareHectometer { get; } = new AreaUnit(SquareHectometerValue); + /// Area unit in square decameters. + public static AreaUnit SquareDecameter { get; } = new AreaUnit(SquareDecameterValue); + /// Area unit in square decimeters. + public static AreaUnit SquareDecimeter { get; } = new AreaUnit(SquareDecimeterValue); + /// Area unit in square meters. + public static AreaUnit SquareMeter { get; } = new AreaUnit(SquareMeterValue); + /// Area unit in square centimeters. + public static AreaUnit SquareCentimeter { get; } = new AreaUnit(SquareCentimeterValue); + /// Area unit in square millimeters. + public static AreaUnit SquareMillimeter { get; } = new AreaUnit(SquareMillimeterValue); + /// Area unit in square inches. + public static AreaUnit SquareInch { get; } = new AreaUnit(SquareInchValue); + /// Area unit in square feet. + public static AreaUnit SquareFoot { get; } = new AreaUnit(SquareFootValue); + /// Area unit in square miles. + public static AreaUnit SquareMile { get; } = new AreaUnit(SquareMileValue); + /// Area unit in square yards. + public static AreaUnit SquareYard { get; } = new AreaUnit(SquareYardValue); + /// Area unit in acres. + public static AreaUnit Acre { get; } = new AreaUnit(AcreValue); + /// Determines if two values are the same. + public static bool operator ==(AreaUnit left, AreaUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AreaUnit left, AreaUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AreaUnit(string value) => new AreaUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AreaUnit other && Equals(other); + /// + public bool Equals(AreaUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.Serialization.cs new file mode 100644 index 0000000000000..a1f7c791fbe8a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + [PersistableModelProxy(typeof(UnknownBaseMetadata))] + public partial class BaseMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + BaseMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseMetadata(document.RootElement, options); + } + + internal static BaseMetadata DeserializeBaseMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("metadataKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AgeMetadata": return AgeMetadata.DeserializeAgeMetadata(element, options); + case "AreaMetadata": return AreaMetadata.DeserializeAreaMetadata(element, options); + case "CurrencyMetadata": return CurrencyMetadata.DeserializeCurrencyMetadata(element, options); + case "DateMetadata": return DateMetadata.DeserializeDateMetadata(element, options); + case "DateTimeMetadata": return DateTimeMetadata.DeserializeDateTimeMetadata(element, options); + case "InformationMetadata": return InformationMetadata.DeserializeInformationMetadata(element, options); + case "LengthMetadata": return LengthMetadata.DeserializeLengthMetadata(element, options); + case "NumberMetadata": return NumberMetadata.DeserializeNumberMetadata(element, options); + case "NumericRangeMetadata": return NumericRangeMetadata.DeserializeNumericRangeMetadata(element, options); + case "OrdinalMetadata": return OrdinalMetadata.DeserializeOrdinalMetadata(element, options); + case "SpeedMetadata": return SpeedMetadata.DeserializeSpeedMetadata(element, options); + case "TemperatureMetadata": return TemperatureMetadata.DeserializeTemperatureMetadata(element, options); + case "TemporalSetMetadata": return TemporalSetMetadata.DeserializeTemporalSetMetadata(element, options); + case "TemporalSpanMetadata": return TemporalSpanMetadata.DeserializeTemporalSpanMetadata(element, options); + case "TimeMetadata": return TimeMetadata.DeserializeTimeMetadata(element, options); + case "VolumeMetadata": return VolumeMetadata.DeserializeVolumeMetadata(element, options); + case "WeightMetadata": return WeightMetadata.DeserializeWeightMetadata(element, options); + } + } + return UnknownBaseMetadata.DeserializeUnknownBaseMetadata(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{options.Format}' format."); + } + } + + BaseMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaseMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static BaseMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBaseMetadata(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.cs new file mode 100644 index 0000000000000..219f3110833be --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/BaseMetadata.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// The abstract base class for entity Metadata. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + public abstract partial class BaseMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected BaseMetadata() + { + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + internal BaseMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData) + { + MetadataKind = metadataKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity Metadata object kind. + internal MetadataKind MetadataKind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..6384f4b931637 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ClassificationDocumentResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationDocumentResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("class"u8); + writer.WriteStartArray(); + foreach (var item in Class) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ClassificationDocumentResultWithDetectedLanguage 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(ClassificationDocumentResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationDocumentResultWithDetectedLanguage(document.RootElement, options); + } + + internal static ClassificationDocumentResultWithDetectedLanguage DeserializeClassificationDocumentResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList @class = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("class"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationResult.DeserializeClassificationResult(item, options)); + } + @class = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClassificationDocumentResultWithDetectedLanguage( + id, + warnings, + statistics, + @class, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ClassificationDocumentResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + ClassificationDocumentResultWithDetectedLanguage 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 DeserializeClassificationDocumentResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClassificationDocumentResultWithDetectedLanguage)} 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 ClassificationDocumentResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeClassificationDocumentResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..63ebe42f9b66b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationDocumentResultWithDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the classification doc result for the task with detected language. + public partial class ClassificationDocumentResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Contains the classification doc results for all docs. + /// , or is null. + internal ClassificationDocumentResultWithDetectedLanguage(string id, IEnumerable warnings, IEnumerable @class) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(@class, nameof(@class)); + + Id = id; + Warnings = warnings.ToList(); + Class = @class.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Contains the classification doc results for all docs. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal ClassificationDocumentResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList @class, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Class = @class; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClassificationDocumentResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Contains the classification doc results for all docs. + public IReadOnlyList Class { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.Serialization.cs new file mode 100644 index 0000000000000..b8ec6d329dcb1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ClassificationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ClassificationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClassificationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClassificationResult(document.RootElement, options); + } + + internal static ClassificationResult DeserializeClassificationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string category = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClassificationResult(category, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ClassificationResult)} does not support writing '{options.Format}' format."); + } + } + + ClassificationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeClassificationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClassificationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ClassificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeClassificationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.cs new file mode 100644 index 0000000000000..17b8c14ef4a16 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationResult.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the classification result. + public partial class ClassificationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Classification type. + /// Confidence score between 0 and 1 of the recognized class. + /// is null. + internal ClassificationResult(string category, double confidenceScore) + { + Argument.AssertNotNull(category, nameof(category)); + + Category = category; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// Classification type. + /// Confidence score between 0 and 1 of the recognized class. + /// Keeps track of any properties unknown to the library. + internal ClassificationResult(string category, double confidenceScore, IDictionary serializedAdditionalRawData) + { + Category = category; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ClassificationResult() + { + } + + /// Classification type. + public string Category { get; } + /// Confidence score between 0 and 1 of the recognized class. + public double ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationType.cs new file mode 100644 index 0000000000000..20f7704d4911f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ClassificationType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Specifies either one or multiple categories per document. Defaults to multi classification which may return more than one class for each document. + public readonly partial struct ClassificationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ClassificationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MultiValue = "Multi"; + private const string SingleValue = "Single"; + + /// Multi selection. + public static ClassificationType Multi { get; } = new ClassificationType(MultiValue); + /// Single selection. + public static ClassificationType Single { get; } = new ClassificationType(SingleValue); + /// Determines if two values are the same. + public static bool operator ==(ClassificationType left, ClassificationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ClassificationType left, ClassificationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ClassificationType(string value) => new ClassificationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ClassificationType other && Equals(other); + /// + public bool Equals(ClassificationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.Serialization.cs new file mode 100644 index 0000000000000..b3635dd2fc65e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CurrencyMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + if (Optional.IsDefined(Iso4217)) + { + writer.WritePropertyName("iso4217"u8); + writer.WriteStringValue(Iso4217); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CurrencyMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCurrencyMetadata(document.RootElement, options); + } + + internal static CurrencyMetadata DeserializeCurrencyMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + string unit = default; + string iso4217 = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("iso4217"u8)) + { + iso4217 = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CurrencyMetadata(metadataKind, serializedAdditionalRawData, value, unit, iso4217); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support writing '{options.Format}' format."); + } + } + + CurrencyMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCurrencyMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CurrencyMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CurrencyMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCurrencyMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.cs new file mode 100644 index 0000000000000..1d853278d6119 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CurrencyMetadata.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Currency ) entity Metadata model. + public partial class CurrencyMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Currency unit. + /// is null. + internal CurrencyMetadata(double value, string unit) + { + Argument.AssertNotNull(unit, nameof(unit)); + + MetadataKind = MetadataKind.CurrencyMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Currency unit. + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + internal CurrencyMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, string unit, string iso4217) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + Iso4217 = iso4217; + } + + /// Initializes a new instance of for deserialization. + internal CurrencyMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Currency unit. + public string Unit { get; } + /// The alphabetic code based on another ISO standard, ISO 3166, which lists the codes for country names. The first two letters of the ISO 4217 three-letter code are the same as the code for the country name, and, where possible, the third letter corresponds to the first letter of the currency name. + public string Iso4217 { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 0000000000000..6325afed440eb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.Serialization.cs @@ -0,0 +1,210 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomAbstractiveSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support writing '{format}' format."); + } + + 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()); + } + if (Optional.IsDefined(SummaryLength)) + { + writer.WritePropertyName("summaryLength"u8); + writer.WriteStringValue(SummaryLength.Value.ToString()); + } + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomAbstractiveSummarizationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationActionContent(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationActionContent DeserializeCustomAbstractiveSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? sentenceCount = default; + StringIndexType? stringIndexType = default; + SummaryLengthBucket? summaryLength = default; + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sentenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentenceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("summaryLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + summaryLength = new SummaryLengthBucket(property.Value.GetString()); + continue; + } + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationActionContent( + sentenceCount, + stringIndexType, + summaryLength, + loggingOptOut, + projectName, + deploymentName, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomAbstractiveSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.cs new file mode 100644 index 0000000000000..998fce3e5d7f9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationActionContent.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for the Custom Abstractive Summarization task. + public partial class CustomAbstractiveSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomAbstractiveSummarizationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// Controls the approximate number of sentences in the output summaries. + /// String index type. + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomAbstractiveSummarizationActionContent(int? sentenceCount, StringIndexType? stringIndexType, SummaryLengthBucket? summaryLength, bool? loggingOptOut, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + SentenceCount = sentenceCount; + StringIndexType = stringIndexType; + SummaryLength = summaryLength; + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationActionContent() + { + } + + /// Controls the approximate number of sentences in the output summaries. + public int? SentenceCount { get; set; } + /// String index type. + public StringIndexType? StringIndexType { get; set; } + /// (NOTE: Recommended to use summaryLength over sentenceCount) Controls the approximate length of the output summaries. + public SummaryLengthBucket? SummaryLength { get; set; } + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..4e660e17e1263 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomAbstractiveSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + 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 + } + } + writer.WriteEndObject(); + } + + CustomAbstractiveSummarizationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationOperationAction(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationOperationAction DeserializeCustomAbstractiveSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomAbstractiveSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + parameters = CustomAbstractiveSummarizationActionContent.DeserializeCustomAbstractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomAbstractiveSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.cs new file mode 100644 index 0000000000000..da7178088d994 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationAction.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the task definition for an Custom Abstractive Summarization task. + public partial class CustomAbstractiveSummarizationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + /// Parameters for the Custom Abstractive Summarization task. + /// is null. + public CustomAbstractiveSummarizationOperationAction(CustomAbstractiveSummarizationActionContent actionContent) + { + Argument.AssertNotNull(actionContent, nameof(actionContent)); + + Kind = AnalyzeTextOperationActionKind.CustomAbstractiveSummarization; + ActionContent = actionContent; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Custom Abstractive Summarization task. + internal CustomAbstractiveSummarizationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomAbstractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationOperationAction() + { + } + + /// Parameters for the Custom Abstractive Summarization task. + public CustomAbstractiveSummarizationActionContent ActionContent { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..05586189839ad --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomAbstractiveSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomAbstractiveSummarizationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationOperationResult(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationOperationResult DeserializeCustomAbstractiveSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomAbstractiveSummarizationResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomAbstractiveSummarizationResult.DeserializeCustomAbstractiveSummarizationResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomAbstractiveSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.cs new file mode 100644 index 0000000000000..456c9a813659d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the results for an Custom Abstractive Summarization task. + public partial class CustomAbstractiveSummarizationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal CustomAbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomAbstractiveSummarizationResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomAbstractiveSummarizationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal CustomAbstractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomAbstractiveSummarizationResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public CustomAbstractiveSummarizationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.Serialization.cs new file mode 100644 index 0000000000000..45fdff6e2e561 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomAbstractiveSummarizationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomAbstractiveSummarizationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomAbstractiveSummarizationResult(document.RootElement, options); + } + + internal static CustomAbstractiveSummarizationResult DeserializeCustomAbstractiveSummarizationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList documents = default; + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AbstractiveSummaryDocumentResultWithDetectedLanguage.DeserializeAbstractiveSummaryDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomAbstractiveSummarizationResult( + documents, + errors, + statistics, + projectName, + deploymentName, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomAbstractiveSummarizationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomAbstractiveSummarizationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomAbstractiveSummarizationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomAbstractiveSummarizationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomAbstractiveSummarizationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.cs new file mode 100644 index 0000000000000..61597af22fc2d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomAbstractiveSummarizationResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the custom summarization results of each document. + public partial class CustomAbstractiveSummarizationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Response by document. + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// , , or is null. + internal CustomAbstractiveSummarizationResult(IEnumerable documents, IEnumerable errors, string projectName, string deploymentName) + { + Argument.AssertNotNull(documents, nameof(documents)); + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + Documents = documents.ToList(); + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// Response by document. + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomAbstractiveSummarizationResult(IReadOnlyList documents, IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + Documents = documents; + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomAbstractiveSummarizationResult() + { + } + + /// Response by document. + public IReadOnlyList Documents { get; } + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.Serialization.cs new file mode 100644 index 0000000000000..656da8643e92b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomEntitiesActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomEntitiesActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntitiesActionContent(document.RootElement, options); + } + + internal static CustomEntitiesActionContent DeserializeCustomEntitiesActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntitiesActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomEntitiesActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntitiesActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntitiesActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomEntitiesActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntitiesActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.cs new file mode 100644 index 0000000000000..12006341d68b4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesActionContent.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Custom Entities task. + public partial class CustomEntitiesActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomEntitiesActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// Keeps track of any properties unknown to the library. + internal CustomEntitiesActionContent(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomEntitiesActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.Serialization.cs new file mode 100644 index 0000000000000..16b641cefd0d3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomEntitiesOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomEntitiesOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntitiesOperationAction(document.RootElement, options); + } + + internal static CustomEntitiesOperationAction DeserializeCustomEntitiesOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomEntitiesActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomEntitiesActionContent.DeserializeCustomEntitiesActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntitiesOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomEntitiesOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntitiesOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntitiesOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomEntitiesOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntitiesOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.cs new file mode 100644 index 0000000000000..ffd5d3e7f4b71 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom text LRO task. + public partial class CustomEntitiesOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomEntitiesOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomEntityRecognition; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// task parameters. + internal CustomEntitiesOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomEntitiesActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// task parameters. + public CustomEntitiesActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..2d4543feefadf --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomEntitiesResultWithDocumentDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntitiesResultWithDocumentDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomEntitiesResultWithDocumentDetectedLanguage 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(CustomEntitiesResultWithDocumentDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntitiesResultWithDocumentDetectedLanguage(document.RootElement, options); + } + + internal static CustomEntitiesResultWithDocumentDetectedLanguage DeserializeCustomEntitiesResultWithDocumentDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntitiesDocumentResultWithDetectedLanguage.DeserializeEntitiesDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntitiesResultWithDocumentDetectedLanguage( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntitiesResultWithDocumentDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + CustomEntitiesResultWithDocumentDetectedLanguage 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 DeserializeCustomEntitiesResultWithDocumentDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntitiesResultWithDocumentDetectedLanguage)} 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 CustomEntitiesResultWithDocumentDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntitiesResultWithDocumentDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.cs new file mode 100644 index 0000000000000..168a748c72f52 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntitiesResultWithDocumentDetectedLanguage.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the list of detected custom entities result for the documents along with detected language. + public partial class CustomEntitiesResultWithDocumentDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Enumeration of the document results with detected language. + /// , , or is null. + internal CustomEntitiesResultWithDocumentDetectedLanguage(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Enumeration of the document results with detected language. + /// Keeps track of any properties unknown to the library. + internal CustomEntitiesResultWithDocumentDetectedLanguage(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomEntitiesResultWithDocumentDetectedLanguage() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Enumeration of the document results with detected language. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 0000000000000..964fef326158e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomEntityRecognitionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomEntityRecognitionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomEntityRecognitionOperationResult(document.RootElement, options); + } + + internal static CustomEntityRecognitionOperationResult DeserializeCustomEntityRecognitionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomEntitiesResultWithDocumentDetectedLanguage results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomEntitiesResultWithDocumentDetectedLanguage.DeserializeCustomEntitiesResultWithDocumentDetectedLanguage(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomEntityRecognitionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomEntityRecognitionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomEntityRecognitionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomEntityRecognitionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomEntityRecognitionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.cs new file mode 100644 index 0000000000000..7884c3ada51ee --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomEntityRecognitionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom entity recognition job result. + public partial class CustomEntityRecognitionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// List of results. + /// is null. + internal CustomEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomEntitiesResultWithDocumentDetectedLanguage results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomEntityRecognitionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// List of results. + internal CustomEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomEntitiesResultWithDocumentDetectedLanguage results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomEntityRecognitionOperationResult() + { + } + + /// List of results. + public CustomEntitiesResultWithDocumentDetectedLanguage Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.Serialization.cs new file mode 100644 index 0000000000000..85170a0dc7dfb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomHealthcareActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHealthcareActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareActionContent(document.RootElement, options); + } + + internal static CustomHealthcareActionContent DeserializeCustomHealthcareActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.cs new file mode 100644 index 0000000000000..4b9024a71ae86 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareActionContent.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a custom Healthcare task. + public partial class CustomHealthcareActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomHealthcareActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareActionContent(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..6eb2e6b6de3cb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("relations"u8); + writer.WriteStartArray(); + foreach (var item in Relations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage 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(CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(document.RootElement, options); + } + + internal static CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage DeserializeCustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + IReadOnlyList relations = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomHealthcareEntity.DeserializeCustomHealthcareEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelation.DeserializeHealthcareRelation(item, options)); + } + relations = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage( + id, + warnings, + statistics, + entities, + relations, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage 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 DeserializeCustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} 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 CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs new file mode 100644 index 0000000000000..9ddb13f2275e5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the document custom healthcare results with detected language. + public partial class CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Healthcare entities. + /// Healthcare entity relations. + /// , , or is null. + internal CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id, IEnumerable warnings, IEnumerable entities, IEnumerable relations) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + Argument.AssertNotNull(relations, nameof(relations)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + Relations = relations.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, IReadOnlyList relations, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + Relations = relations; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Healthcare entities. + public IReadOnlyList Entities { get; } + /// Healthcare entity relations. + public IReadOnlyList Relations { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.Serialization.cs new file mode 100644 index 0000000000000..347a4f3c18161 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.Serialization.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomHealthcareEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support writing '{format}' format."); + } + + writer.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, options); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Links)) + { + writer.WritePropertyName("links"u8); + writer.WriteStartArray(); + foreach (var item in Links) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(EntityComponentInformation)) + { + writer.WritePropertyName("entityComponentInformation"u8); + writer.WriteStartArray(); + foreach (var item in EntityComponentInformation) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHealthcareEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareEntity(document.RootElement, options); + } + + internal static CustomHealthcareEntity DeserializeCustomHealthcareEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + HealthcareEntityCategory category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + HealthcareAssertion assertion = default; + string name = default; + IReadOnlyList links = default; + IReadOnlyList entityComponentInformation = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = new HealthcareEntityCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("assertion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + assertion = HealthcareAssertion.DeserializeHealthcareAssertion(property.Value, options); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("links"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntityLink.DeserializeHealthcareEntityLink(item, options)); + } + links = array; + continue; + } + if (property.NameEquals("entityComponentInformation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.EntityComponentInformation.DeserializeEntityComponentInformation(item, options)); + } + entityComponentInformation = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links ?? new ChangeTrackingList(), + entityComponentInformation ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.cs new file mode 100644 index 0000000000000..1b741b77b6347 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareEntity.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom healthcare entity. + public partial class CustomHealthcareEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// is null. + internal CustomHealthcareEntity(string text, HealthcareEntityCategory category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Links = new ChangeTrackingList(); + EntityComponentInformation = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// + /// (Optional) Entity component information listing fired components of the extracted entity. This object only applies for custom healthcare. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareEntity(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareAssertion assertion, string name, IReadOnlyList links, IReadOnlyList entityComponentInformation, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Assertion = assertion; + Name = name; + Links = links; + EntityComponentInformation = entityComponentInformation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Healthcare Entity Category. + public HealthcareEntityCategory Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + /// Assertion of the entity. + public HealthcareAssertion Assertion { get; } + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + public string Name { get; } + /// Entity references in known data sources. + public IReadOnlyList Links { get; } + /// + /// (Optional) Entity component information listing fired components of the extracted entity. This object only applies for custom healthcare. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IReadOnlyList EntityComponentInformation { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.Serialization.cs new file mode 100644 index 0000000000000..dcea88ea6ea75 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomHealthcareOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomHealthcareOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareOperationAction(document.RootElement, options); + } + + internal static CustomHealthcareOperationAction DeserializeCustomHealthcareOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomHealthcareActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomHealthcareActionContent.DeserializeCustomHealthcareActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomHealthcareOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.cs new file mode 100644 index 0000000000000..b0a4d4bccba28 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom healthcare task definition. + public partial class CustomHealthcareOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomHealthcareOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomHealthcare; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the custom healthcare task parameters. + internal CustomHealthcareOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomHealthcareActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Contains the custom healthcare task parameters. + public CustomHealthcareActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.Serialization.cs new file mode 100644 index 0000000000000..e92fec7c509b0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomHealthcareOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHealthcareOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareOperationResult(document.RootElement, options); + } + + internal static CustomHealthcareOperationResult DeserializeCustomHealthcareOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomHealthcareResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomHealthcareResult.DeserializeCustomHealthcareResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomHealthcareOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.cs new file mode 100644 index 0000000000000..6f1ca4665789b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom healthcare job result. + public partial class CustomHealthcareOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Contains the list of document results. + /// is null. + internal CustomHealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomHealthcareResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomHealthcareOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Contains the list of document results. + internal CustomHealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomHealthcareResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareOperationResult() + { + } + + /// Contains the list of document results. + public CustomHealthcareResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.Serialization.cs new file mode 100644 index 0000000000000..b07f0622ee043 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomHealthcareResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHealthcareResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHealthcareResult(document.RootElement, options); + } + + internal static CustomHealthcareResult DeserializeCustomHealthcareResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.DeserializeCustomHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHealthcareResult( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support writing '{options.Format}' format."); + } + } + + CustomHealthcareResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHealthcareResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHealthcareResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomHealthcareResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomHealthcareResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.cs new file mode 100644 index 0000000000000..40310750836b8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomHealthcareResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom healthcare result for the request. + public partial class CustomHealthcareResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// List of custom healthcare results for the document. + /// , , or is null. + internal CustomHealthcareResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// List of custom healthcare results for the document. + /// Keeps track of any properties unknown to the library. + internal CustomHealthcareResult(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHealthcareResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// List of custom healthcare results for the document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..cd54275d9a884 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomLabelClassificationResultWithDocumentDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomLabelClassificationResultWithDocumentDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomLabelClassificationResultWithDocumentDetectedLanguage 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(CustomLabelClassificationResultWithDocumentDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomLabelClassificationResultWithDocumentDetectedLanguage(document.RootElement, options); + } + + internal static CustomLabelClassificationResultWithDocumentDetectedLanguage DeserializeCustomLabelClassificationResultWithDocumentDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationDocumentResultWithDetectedLanguage.DeserializeClassificationDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomLabelClassificationResultWithDocumentDetectedLanguage( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomLabelClassificationResultWithDocumentDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + CustomLabelClassificationResultWithDocumentDetectedLanguage 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 DeserializeCustomLabelClassificationResultWithDocumentDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomLabelClassificationResultWithDocumentDetectedLanguage)} 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 CustomLabelClassificationResultWithDocumentDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomLabelClassificationResultWithDocumentDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.cs new file mode 100644 index 0000000000000..bac3a47507de8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomLabelClassificationResultWithDocumentDetectedLanguage.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom label classification with detected language results. + public partial class CustomLabelClassificationResultWithDocumentDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Response by document. + /// , , or is null. + internal CustomLabelClassificationResultWithDocumentDetectedLanguage(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal CustomLabelClassificationResultWithDocumentDetectedLanguage(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomLabelClassificationResultWithDocumentDetectedLanguage() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.Serialization.cs new file mode 100644 index 0000000000000..9974eb70e728b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomMultiLabelClassificationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomMultiLabelClassificationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomMultiLabelClassificationActionContent(document.RootElement, options); + } + + internal static CustomMultiLabelClassificationActionContent DeserializeCustomMultiLabelClassificationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomMultiLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomMultiLabelClassificationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomMultiLabelClassificationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomMultiLabelClassificationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomMultiLabelClassificationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.cs new file mode 100644 index 0000000000000..e6e1cea654d95 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationActionContent.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Custom Multi Classification task. + public partial class CustomMultiLabelClassificationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomMultiLabelClassificationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomMultiLabelClassificationActionContent(bool? loggingOptOut, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomMultiLabelClassificationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..a3d54554b7f57 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomMultiLabelClassificationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomMultiLabelClassificationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomMultiLabelClassificationOperationAction(document.RootElement, options); + } + + internal static CustomMultiLabelClassificationOperationAction DeserializeCustomMultiLabelClassificationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomMultiLabelClassificationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomMultiLabelClassificationActionContent.DeserializeCustomMultiLabelClassificationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomMultiLabelClassificationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomMultiLabelClassificationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomMultiLabelClassificationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomMultiLabelClassificationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomMultiLabelClassificationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.cs new file mode 100644 index 0000000000000..13943f68dd354 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Use custom models to classify text into multi label taxonomy. + public partial class CustomMultiLabelClassificationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomMultiLabelClassificationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomMultiLabelClassification; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal CustomMultiLabelClassificationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomMultiLabelClassificationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public CustomMultiLabelClassificationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..e7d7bee5278ba --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomMultiLabelClassificationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomMultiLabelClassificationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomMultiLabelClassificationOperationResult(document.RootElement, options); + } + + internal static CustomMultiLabelClassificationOperationResult DeserializeCustomMultiLabelClassificationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomLabelClassificationResultWithDocumentDetectedLanguage results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomLabelClassificationResultWithDocumentDetectedLanguage.DeserializeCustomLabelClassificationResultWithDocumentDetectedLanguage(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomMultiLabelClassificationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomMultiLabelClassificationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomMultiLabelClassificationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomMultiLabelClassificationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomMultiLabelClassificationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomMultiLabelClassificationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.cs new file mode 100644 index 0000000000000..99446f5f36c32 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomMultiLabelClassificationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom multi label classification job result. + public partial class CustomMultiLabelClassificationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// List of results. + /// is null. + internal CustomMultiLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomLabelClassificationResultWithDocumentDetectedLanguage results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomMultiLabelClassificationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// List of results. + internal CustomMultiLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomLabelClassificationResultWithDocumentDetectedLanguage results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomMultiLabelClassificationOperationResult() + { + } + + /// List of results. + public CustomLabelClassificationResultWithDocumentDetectedLanguage Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.Serialization.cs new file mode 100644 index 0000000000000..1ab9db0fbb7e0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSentenceSentiment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSentenceSentiment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentenceSentiment(document.RootElement, options); + } + + internal static CustomSentenceSentiment DeserializeCustomSentenceSentiment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + SentenceSentimentValue sentiment = default; + SentimentConfidenceScores confidenceScores = default; + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToSentenceSentimentValue(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support writing '{options.Format}' format."); + } + } + + CustomSentenceSentiment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentenceSentiment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentenceSentiment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentenceSentiment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentenceSentiment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.cs new file mode 100644 index 0000000000000..25975198494be --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentenceSentiment.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A document's sentence custom sentiment. + public partial class CustomSentenceSentiment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// or is null. + internal CustomSentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// Keeps track of any properties unknown to the library. + internal CustomSentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IDictionary serializedAdditionalRawData) + { + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentenceSentiment() + { + } + + /// The sentence text. + public string Text { get; } + /// The predicted Sentiment for the sentence. + public SentenceSentimentValue Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.Serialization.cs new file mode 100644 index 0000000000000..475da787b2a85 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSentimentAnalysisActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSentimentAnalysisActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisActionContent(document.RootElement, options); + } + + internal static CustomSentimentAnalysisActionContent DeserializeCustomSentimentAnalysisActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisActionContent(loggingOptOut, projectName, deploymentName, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentimentAnalysisActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.cs new file mode 100644 index 0000000000000..f70e2f690acc3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisActionContent.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Custom Sentiment Analysis task. + public partial class CustomSentimentAnalysisActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomSentimentAnalysisActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Specifies the method used to interpret string offsets. + /// Keeps track of any properties unknown to the library. + internal CustomSentimentAnalysisActionContent(bool? loggingOptOut, string projectName, string deploymentName, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.Serialization.cs new file mode 100644 index 0000000000000..5b09ab5637a4c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSentimentAnalysisOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomSentimentAnalysisOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisOperationAction(document.RootElement, options); + } + + internal static CustomSentimentAnalysisOperationAction DeserializeCustomSentimentAnalysisOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSentimentAnalysisActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomSentimentAnalysisActionContent.DeserializeCustomSentimentAnalysisActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSentimentAnalysisOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.cs new file mode 100644 index 0000000000000..65375b1327c94 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Use custom models to ease the process of sentiment analysis from documents like product reviews. + public partial class CustomSentimentAnalysisOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomSentimentAnalysisOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomSentimentAnalysis; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Custom Sentiment Analysis task parameters. + internal CustomSentimentAnalysisOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomSentimentAnalysisActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Custom Sentiment Analysis task parameters. + public CustomSentimentAnalysisActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.Serialization.cs new file mode 100644 index 0000000000000..d64e8ddf536f7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSentimentAnalysisOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSentimentAnalysisOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisOperationResult(document.RootElement, options); + } + + internal static CustomSentimentAnalysisOperationResult DeserializeCustomSentimentAnalysisOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSentimentAnalysisResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomSentimentAnalysisResult.DeserializeCustomSentimentAnalysisResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSentimentAnalysisOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.cs new file mode 100644 index 0000000000000..e3cd90675ca1a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Custom Sentiment Analysis Analyze Text long tunning operation result object. + public partial class CustomSentimentAnalysisOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal CustomSentimentAnalysisOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomSentimentAnalysisResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomSentimentAnalysisOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal CustomSentimentAnalysisOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomSentimentAnalysisResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisOperationResult() + { + } + + /// Results of the task. + public CustomSentimentAnalysisResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.Serialization.cs new file mode 100644 index 0000000000000..cd1720c8f1694 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSentimentAnalysisResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + writer.WritePropertyName("documents"u8); + writer.WriteStartArray(); + foreach (var item in Documents) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSentimentAnalysisResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisResult(document.RootElement, options); + } + + internal static CustomSentimentAnalysisResult DeserializeCustomSentimentAnalysisResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string projectName = default; + string deploymentName = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomSentimentAnalysisResultDocument.DeserializeCustomSentimentAnalysisResultDocument(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisResult( + errors, + statistics, + projectName, + deploymentName, + documents, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentimentAnalysisResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.cs new file mode 100644 index 0000000000000..daed28cc09781 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResult.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Custom Sentiment analysis results for the input documents. + public partial class CustomSentimentAnalysisResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// The custom sentiment analysis results for each document in the input. + /// , , or is null. + internal CustomSentimentAnalysisResult(IEnumerable errors, string projectName, string deploymentName, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// The custom sentiment analysis results for each document in the input. + /// Keeps track of any properties unknown to the library. + internal CustomSentimentAnalysisResult(IReadOnlyList errors, RequestStatistics statistics, string projectName, string deploymentName, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ProjectName = projectName; + DeploymentName = deploymentName; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + /// The custom sentiment analysis results for each document in the input. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.Serialization.cs new file mode 100644 index 0000000000000..a46d97cdec34a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSentimentAnalysisResultDocument : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("sentences"u8); + writer.WriteStartArray(); + foreach (var item in Sentences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSentimentAnalysisResultDocument IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSentimentAnalysisResultDocument(document.RootElement, options); + } + + internal static CustomSentimentAnalysisResultDocument DeserializeCustomSentimentAnalysisResultDocument(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DocumentSentiment sentiment = default; + SentimentConfidenceScores confidenceScores = default; + IReadOnlyList sentences = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToDocumentSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomSentenceSentiment.DeserializeCustomSentenceSentiment(item, options)); + } + sentences = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSentimentAnalysisResultDocument( + id, + warnings, + statistics, + sentiment, + confidenceScores, + sentences, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support writing '{options.Format}' format."); + } + } + + CustomSentimentAnalysisResultDocument IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSentimentAnalysisResultDocument(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSentimentAnalysisResultDocument)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSentimentAnalysisResultDocument FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSentimentAnalysisResultDocument(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.cs new file mode 100644 index 0000000000000..9c6951475a6a4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSentimentAnalysisResultDocument.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Custom Sentiment analysis result for a specific document. + public partial class CustomSentimentAnalysisResultDocument + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// , , or is null. + internal CustomSentimentAnalysisResultDocument(string id, IEnumerable warnings, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IEnumerable sentences) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(sentences, nameof(sentences)); + + Id = id; + Warnings = warnings.ToList(); + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal CustomSentimentAnalysisResultDocument(string id, IReadOnlyList warnings, DocumentStatistics statistics, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IReadOnlyList sentences, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSentimentAnalysisResultDocument() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + public DocumentSentiment Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The document's sentences sentiment. + public IReadOnlyList Sentences { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.Serialization.cs new file mode 100644 index 0000000000000..971bb76e263c2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSingleLabelClassificationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(LoggingOptOut)) + { + writer.WritePropertyName("loggingOptOut"u8); + writer.WriteBooleanValue(LoggingOptOut.Value); + } + writer.WritePropertyName("projectName"u8); + writer.WriteStringValue(ProjectName); + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSingleLabelClassificationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSingleLabelClassificationActionContent(document.RootElement, options); + } + + internal static CustomSingleLabelClassificationActionContent DeserializeCustomSingleLabelClassificationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string projectName = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("projectName"u8)) + { + projectName = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSingleLabelClassificationActionContent(loggingOptOut, projectName, deploymentName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support writing '{options.Format}' format."); + } + } + + CustomSingleLabelClassificationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSingleLabelClassificationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CustomSingleLabelClassificationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSingleLabelClassificationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.cs new file mode 100644 index 0000000000000..37242bf640f64 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationActionContent.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Custom Single Classification task. + public partial class CustomSingleLabelClassificationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// or is null. + public CustomSingleLabelClassificationActionContent(string projectName, string deploymentName) + { + Argument.AssertNotNull(projectName, nameof(projectName)); + Argument.AssertNotNull(deploymentName, nameof(deploymentName)); + + ProjectName = projectName; + DeploymentName = deploymentName; + } + + /// Initializes a new instance of . + /// logging opt out. + /// This field indicates the project name for the model. + /// This field indicates the deployment name for the model. + /// Keeps track of any properties unknown to the library. + internal CustomSingleLabelClassificationActionContent(bool? loggingOptOut, string projectName, string deploymentName, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ProjectName = projectName; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomSingleLabelClassificationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// This field indicates the project name for the model. + public string ProjectName { get; } + /// This field indicates the deployment name for the model. + public string DeploymentName { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..63b28fbca4f84 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSingleLabelClassificationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + CustomSingleLabelClassificationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSingleLabelClassificationOperationAction(document.RootElement, options); + } + + internal static CustomSingleLabelClassificationOperationAction DeserializeCustomSingleLabelClassificationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomSingleLabelClassificationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = CustomSingleLabelClassificationActionContent.DeserializeCustomSingleLabelClassificationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSingleLabelClassificationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + CustomSingleLabelClassificationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSingleLabelClassificationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSingleLabelClassificationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSingleLabelClassificationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.cs new file mode 100644 index 0000000000000..1fc43de17e717 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Use custom models to classify text into single label taxonomy. + public partial class CustomSingleLabelClassificationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public CustomSingleLabelClassificationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.CustomSingleLabelClassification; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal CustomSingleLabelClassificationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, CustomSingleLabelClassificationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public CustomSingleLabelClassificationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..a7f025d88f172 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class CustomSingleLabelClassificationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomSingleLabelClassificationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomSingleLabelClassificationOperationResult(document.RootElement, options); + } + + internal static CustomSingleLabelClassificationOperationResult DeserializeCustomSingleLabelClassificationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomLabelClassificationResultWithDocumentDetectedLanguage results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = CustomLabelClassificationResultWithDocumentDetectedLanguage.DeserializeCustomLabelClassificationResultWithDocumentDetectedLanguage(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomSingleLabelClassificationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + CustomSingleLabelClassificationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomSingleLabelClassificationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomSingleLabelClassificationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CustomSingleLabelClassificationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCustomSingleLabelClassificationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.cs new file mode 100644 index 0000000000000..2587556df929e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/CustomSingleLabelClassificationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the custom single label classification job result. + public partial class CustomSingleLabelClassificationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// List of results. + /// is null. + internal CustomSingleLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, CustomLabelClassificationResultWithDocumentDetectedLanguage results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.CustomSingleLabelClassificationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// List of results. + internal CustomSingleLabelClassificationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, CustomLabelClassificationResultWithDocumentDetectedLanguage results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal CustomSingleLabelClassificationOperationResult() + { + } + + /// List of results. + public CustomLabelClassificationResultWithDocumentDetectedLanguage Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.Serialization.cs new file mode 100644 index 0000000000000..46d724a196b9e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DateMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DateMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateMetadata(document.RootElement, options); + } + + internal static DateMetadata DeserializeDateMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DateMetadata)} does not support writing '{options.Format}' format."); + } + } + + DateMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDateMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DateMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.cs new file mode 100644 index 0000000000000..5a0c0a6a60eff --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A Metadata for date entity instances. + public partial class DateMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal DateMetadata() + { + MetadataKind = MetadataKind.DateMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal DateMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.Serialization.cs new file mode 100644 index 0000000000000..eaf271e4f12d1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DateTimeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DateTimeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateTimeMetadata(document.RootElement, options); + } + + internal static DateTimeMetadata DeserializeDateTimeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateTimeMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support writing '{options.Format}' format."); + } + } + + DateTimeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDateTimeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateTimeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DateTimeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateTimeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.cs new file mode 100644 index 0000000000000..bb81ff48a2168 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateTimeMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A Metadata for datetime entity instances. + public partial class DateTimeMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal DateTimeMetadata() + { + MetadataKind = MetadataKind.DateTimeMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal DateTimeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.Serialization.cs new file mode 100644 index 0000000000000..ef711e1b3492a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.Serialization.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DateValue : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateValue)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("timex"u8); + writer.WriteStringValue(Timex); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + if (Optional.IsDefined(Modifier)) + { + writer.WritePropertyName("modifier"u8); + writer.WriteStringValue(Modifier.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DateValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DateValue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDateValue(document.RootElement, options); + } + + internal static DateValue DeserializeDateValue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string timex = default; + string value = default; + TemporalModifier? modifier = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("timex"u8)) + { + timex = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("modifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifier = new TemporalModifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DateValue(timex, value, modifier, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DateValue)} does not support writing '{options.Format}' format."); + } + } + + DateValue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDateValue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DateValue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DateValue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDateValue(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.cs new file mode 100644 index 0000000000000..9dd9567422729 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DateValue.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the date value. + public partial class DateValue + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The actual time that the extracted text denote. + /// or is null. + internal DateValue(string timex, string value) + { + Argument.AssertNotNull(timex, nameof(timex)); + Argument.AssertNotNull(value, nameof(value)); + + Timex = timex; + Value = value; + } + + /// Initializes a new instance of . + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + /// The actual time that the extracted text denote. + /// Modifier for datetime to indicate point of reference like before, after etc. + /// Keeps track of any properties unknown to the library. + internal DateValue(string timex, string value, TemporalModifier? modifier, IDictionary serializedAdditionalRawData) + { + Timex = timex; + Value = value; + Modifier = modifier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DateValue() + { + } + + /// An extended ISO 8601 date/time representation as described in (https://github.com/Microsoft/Recognizers-Text/blob/master/Patterns/English/English-DateTime.yaml). + public string Timex { get; } + /// The actual time that the extracted text denote. + public string Value { get; } + /// Modifier for datetime to indicate point of reference like before, after etc. + public TemporalModifier? Modifier { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..ca5524a8a95a5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("iso6391Name"u8); + writer.WriteStringValue(Iso6391Name); + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore); + if (Optional.IsDefined(Script)) + { + writer.WritePropertyName("script"u8); + writer.WriteStringValue(Script.Value.ToString()); + } + if (Optional.IsDefined(ScriptCode)) + { + writer.WritePropertyName("scriptCode"u8); + writer.WriteStringValue(ScriptCode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DetectedLanguage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDetectedLanguage(document.RootElement, options); + } + + internal static DetectedLanguage DeserializeDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string iso6391Name = default; + double confidenceScore = default; + ScriptKind? script = default; + ScriptCode? scriptCode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("iso6391Name"u8)) + { + iso6391Name = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("script"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + script = new ScriptKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("scriptCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scriptCode = new ScriptCode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DetectedLanguage( + name, + iso6391Name, + confidenceScore, + script, + scriptCode, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + DetectedLanguage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DetectedLanguage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.cs new file mode 100644 index 0000000000000..678c081a00086 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DetectedLanguage.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the details of the detected language for the text. + public partial class DetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Long name of a detected language (e.g. English, French). + /// A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + /// A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + /// or is null. + internal DetectedLanguage(string name, string iso6391Name, double confidenceScore) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(iso6391Name, nameof(iso6391Name)); + + Name = name; + Iso6391Name = iso6391Name; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// Long name of a detected language (e.g. English, French). + /// A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + /// A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + /// Identifies the script of the input document. + /// Identifies the script of the input document. + /// Keeps track of any properties unknown to the library. + internal DetectedLanguage(string name, string iso6391Name, double confidenceScore, ScriptKind? script, ScriptCode? scriptCode, IDictionary serializedAdditionalRawData) + { + Name = name; + Iso6391Name = iso6391Name; + ConfidenceScore = confidenceScore; + Script = script; + ScriptCode = scriptCode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DetectedLanguage() + { + } + + /// Long name of a detected language (e.g. English, French). + public string Name { get; } + /// A two letter representation of the detected language according to the ISO 639-1 standard (e.g. en, fr). + public string Iso6391Name { get; } + /// A confidence score between 0 and 1. Scores close to 1 indicate 100% certainty that the identified language is true. + public double ConfidenceScore { get; } + /// Identifies the script of the input document. + public ScriptKind? Script { get; } + /// Identifies the script of the input document. + public ScriptCode? ScriptCode { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.Serialization.cs new file mode 100644 index 0000000000000..b020bd418bed8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DocumentError : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentError)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + DocumentError IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentError(document.RootElement, options); + } + + internal static DocumentError DeserializeDocumentError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + AnalyzeTextError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + error = AnalyzeTextError.DeserializeAnalyzeTextError(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentError(id, error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentError)} does not support writing '{options.Format}' format."); + } + } + + DocumentError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.cs new file mode 100644 index 0000000000000..50a08083692f0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentError.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains details of errors encountered during a job execution. + public partial class DocumentError + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// or is null. + internal DocumentError(string id, AnalyzeTextError error) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(error, nameof(error)); + + Id = id; + Error = error; + } + + /// Initializes a new instance of . + /// The ID of the input document. + /// Error encountered. + /// Keeps track of any properties unknown to the library. + internal DocumentError(string id, AnalyzeTextError error, IDictionary serializedAdditionalRawData) + { + Id = id; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentError() + { + } + + /// The ID of the input document. + public string Id { get; } + /// Error encountered. + public AnalyzeTextError Error { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.Serialization.cs new file mode 100644 index 0000000000000..9de3c84af7ffc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class DocumentSentimentExtensions + { + public static string ToSerialString(this DocumentSentiment value) => value switch + { + DocumentSentiment.Positive => "positive", + DocumentSentiment.Neutral => "neutral", + DocumentSentiment.Negative => "negative", + DocumentSentiment.Mixed => "mixed", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DocumentSentiment value.") + }; + + public static DocumentSentiment ToDocumentSentiment(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return DocumentSentiment.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "neutral")) return DocumentSentiment.Neutral; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return DocumentSentiment.Negative; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "mixed")) return DocumentSentiment.Mixed; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DocumentSentiment value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.cs new file mode 100644 index 0000000000000..ab3efb6cbf20e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentSentiment.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + public enum DocumentSentiment + { + /// Positive statement. + Positive, + /// Neutral statement. + Neutral, + /// Negative statement. + Negative, + /// Mixed statement. + Mixed + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.Serialization.cs new file mode 100644 index 0000000000000..1c23b9ab93f62 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DocumentStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + DocumentStatistics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentStatistics(document.RootElement, options); + } + + internal static DocumentStatistics DeserializeDocumentStatistics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int charactersCount = default; + int transactionsCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("charactersCount"u8)) + { + charactersCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("transactionsCount"u8)) + { + transactionsCount = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentStatistics(charactersCount, transactionsCount, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support writing '{options.Format}' format."); + } + } + + DocumentStatistics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentStatistics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentStatistics(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.cs new file mode 100644 index 0000000000000..a1d4ffd59d230 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentStatistics.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// if showStats=true was specified in the request this field will contain information about the document payload. + public partial class DocumentStatistics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of text elements recognized in the document. + /// Number of transactions for the document. + internal DocumentStatistics(int charactersCount, int transactionsCount) + { + CharactersCount = charactersCount; + TransactionsCount = transactionsCount; + } + + /// Initializes a new instance of . + /// Number of text elements recognized in the document. + /// Number of transactions for the document. + /// Keeps track of any properties unknown to the library. + internal DocumentStatistics(int charactersCount, int transactionsCount, IDictionary serializedAdditionalRawData) + { + CharactersCount = charactersCount; + TransactionsCount = transactionsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentStatistics() + { + } + + /// Number of text elements recognized in the document. + public int CharactersCount { get; } + /// Number of transactions for the document. + public int TransactionsCount { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.Serialization.cs new file mode 100644 index 0000000000000..3f46ad51bf2a4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DocumentWarning : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + DocumentWarning IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentWarning)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentWarning(document.RootElement, options); + } + + internal static DocumentWarning DeserializeDocumentWarning(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WarningCode code = default; + string message = default; + string targetRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new WarningCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetRef"u8)) + { + targetRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentWarning(code, message, targetRef, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentWarning)} does not support writing '{options.Format}' format."); + } + } + + DocumentWarning IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDocumentWarning(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentWarning)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DocumentWarning FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDocumentWarning(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.cs new file mode 100644 index 0000000000000..6607f5072a4e7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DocumentWarning.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the warnings object with warnings encountered for the processed document. + public partial class DocumentWarning + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// is null. + internal DocumentWarning(WarningCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + } + + /// Initializes a new instance of . + /// Warning code. + /// Warning message. + /// A JSON pointer reference indicating the target object. + /// Keeps track of any properties unknown to the library. + internal DocumentWarning(WarningCode code, string message, string targetRef, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + TargetRef = targetRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DocumentWarning() + { + } + + /// Warning code. + public WarningCode Code { get; } + /// Warning message. + public string Message { get; } + /// A JSON pointer reference indicating the target object. + public string TargetRef { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.Serialization.cs new file mode 100644 index 0000000000000..94d9b45af7015 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DynamicClassificationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support writing '{format}' format."); + } + + 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(ClassificationType)) + { + writer.WritePropertyName("classificationType"u8); + writer.WriteStringValue(ClassificationType.Value.ToString()); + } + writer.WritePropertyName("categories"u8); + writer.WriteStartArray(); + foreach (var item in Categories) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DynamicClassificationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicClassificationActionContent(document.RootElement, options); + } + + internal static DynamicClassificationActionContent DeserializeDynamicClassificationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + ClassificationType? classificationType = default; + IList categories = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("classificationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + classificationType = new ClassificationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("categories"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + categories = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DynamicClassificationActionContent(loggingOptOut, modelVersion, classificationType, categories, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support writing '{options.Format}' format."); + } + } + + DynamicClassificationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDynamicClassificationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DynamicClassificationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DynamicClassificationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDynamicClassificationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.cs new file mode 100644 index 0000000000000..8f058aba65b18 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationActionContent.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Dynamic Classification task. + public partial class DynamicClassificationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// a list of categories to which input is classified to. + /// is null. + public DynamicClassificationActionContent(IEnumerable categories) + { + Argument.AssertNotNull(categories, nameof(categories)); + + Categories = categories.ToList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Specifies either one or multiple categories per document. Defaults to multi classification which may return more than one class for each document. + /// a list of categories to which input is classified to. + /// Keeps track of any properties unknown to the library. + internal DynamicClassificationActionContent(bool? loggingOptOut, string modelVersion, ClassificationType? classificationType, IList categories, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + ClassificationType = classificationType; + Categories = categories; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DynamicClassificationActionContent() + { + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Specifies either one or multiple categories per document. Defaults to multi classification which may return more than one class for each document. + public ClassificationType? ClassificationType { get; set; } + /// a list of categories to which input is classified to. + public IList Categories { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.Serialization.cs new file mode 100644 index 0000000000000..ecf9034a80df9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DynamicClassificationDocumentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("classifications"u8); + writer.WriteStartArray(); + foreach (var item in Classifications) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DynamicClassificationDocumentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicClassificationDocumentResult(document.RootElement, options); + } + + internal static DynamicClassificationDocumentResult DeserializeDynamicClassificationDocumentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList classifications = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("classifications"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ClassificationResult.DeserializeClassificationResult(item, options)); + } + classifications = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DynamicClassificationDocumentResult(id, warnings, statistics, classifications, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support writing '{options.Format}' format."); + } + } + + DynamicClassificationDocumentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDynamicClassificationDocumentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DynamicClassificationDocumentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DynamicClassificationDocumentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDynamicClassificationDocumentResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.cs new file mode 100644 index 0000000000000..bac958bc83bce --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationDocumentResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the Dynamic Classification document result. + public partial class DynamicClassificationDocumentResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Array of classification results. + /// , or is null. + internal DynamicClassificationDocumentResult(string id, IEnumerable warnings, IEnumerable classifications) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(classifications, nameof(classifications)); + + Id = id; + Warnings = warnings.ToList(); + Classifications = classifications.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Array of classification results. + /// Keeps track of any properties unknown to the library. + internal DynamicClassificationDocumentResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList classifications, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Classifications = classifications; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DynamicClassificationDocumentResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Array of classification results. + public IReadOnlyList Classifications { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.Serialization.cs new file mode 100644 index 0000000000000..87061d0108ad2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class DynamicClassificationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + DynamicClassificationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDynamicClassificationResult(document.RootElement, options); + } + + internal static DynamicClassificationResult DeserializeDynamicClassificationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DynamicClassificationDocumentResult.DeserializeDynamicClassificationDocumentResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DynamicClassificationResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support writing '{options.Format}' format."); + } + } + + DynamicClassificationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDynamicClassificationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DynamicClassificationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DynamicClassificationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDynamicClassificationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.cs new file mode 100644 index 0000000000000..1dda3d803e09e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/DynamicClassificationResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the Dynamic Classification result. + public partial class DynamicClassificationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal DynamicClassificationResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal DynamicClassificationResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DynamicClassificationResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.Serialization.cs new file mode 100644 index 0000000000000..92bdacfb834af --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.Serialization.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntitiesActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support writing '{format}' format."); + } + + 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(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Inclusions)) + { + writer.WritePropertyName("inclusionList"u8); + writer.WriteStartArray(); + foreach (var item in Inclusions) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Exclusions)) + { + writer.WritePropertyName("exclusionList"u8); + writer.WriteStartArray(); + foreach (var item in Exclusions) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(OverlapPolicy)) + { + writer.WritePropertyName("overlapPolicy"u8); + writer.WriteObjectValue(OverlapPolicy, options); + } + if (Optional.IsDefined(InferenceOptions)) + { + writer.WritePropertyName("inferenceOptions"u8); + writer.WriteObjectValue(InferenceOptions, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntitiesActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesActionContent(document.RootElement, options); + } + + internal static EntitiesActionContent DeserializeEntitiesActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + StringIndexType? stringIndexType = default; + IList inclusionList = default; + IList exclusionList = default; + EntityOverlapPolicy overlapPolicy = default; + EntityInferenceConfig inferenceOptions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("inclusionList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new EntityCategory(item.GetString())); + } + inclusionList = array; + continue; + } + if (property.NameEquals("exclusionList"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new EntityCategory(item.GetString())); + } + exclusionList = array; + continue; + } + if (property.NameEquals("overlapPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + overlapPolicy = EntityOverlapPolicy.DeserializeEntityOverlapPolicy(property.Value, options); + continue; + } + if (property.NameEquals("inferenceOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + inferenceOptions = EntityInferenceConfig.DeserializeEntityInferenceConfig(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesActionContent( + loggingOptOut, + modelVersion, + stringIndexType, + inclusionList ?? new ChangeTrackingList(), + exclusionList ?? new ChangeTrackingList(), + overlapPolicy, + inferenceOptions, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support writing '{options.Format}' format."); + } + } + + EntitiesActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntitiesActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.cs new file mode 100644 index 0000000000000..803e7bb83a1da --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesActionContent.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for an Entity Recognition task. + public partial class EntitiesActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EntitiesActionContent() + { + Inclusions = new ChangeTrackingList(); + Exclusions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// (Optional) parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// (Optional) request parameter that limits the output to the requested entity types included in this list. We will apply inclusionList before exclusionList. + /// (Optional) request parameter that filters out any entities that are included the excludeList. When a user specifies an excludeList, they cannot get a prediction returned with an entity in that list. We will apply inclusionList before exclusionList. + /// + /// (Optional) describes the type of overlap policy to apply to the ner output. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// (Optional) request parameter that allows the user to provide settings for running the inference. + /// Keeps track of any properties unknown to the library. + internal EntitiesActionContent(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType, IList inclusions, IList exclusions, EntityOverlapPolicy overlapPolicy, EntityInferenceConfig inferenceOptions, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + StringIndexType = stringIndexType; + Inclusions = inclusions; + Exclusions = exclusions; + OverlapPolicy = overlapPolicy; + InferenceOptions = inferenceOptions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// (Optional) parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + /// (Optional) request parameter that limits the output to the requested entity types included in this list. We will apply inclusionList before exclusionList. + public IList Inclusions { get; } + /// (Optional) request parameter that filters out any entities that are included the excludeList. When a user specifies an excludeList, they cannot get a prediction returned with an entity in that list. We will apply inclusionList before exclusionList. + public IList Exclusions { get; } + /// + /// (Optional) describes the type of overlap policy to apply to the ner output. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public EntityOverlapPolicy OverlapPolicy { get; set; } + /// (Optional) request parameter that allows the user to provide settings for running the inference. + public EntityInferenceConfig InferenceOptions { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..02bd7419b4e84 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntitiesDocumentResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntitiesDocumentResultWithDetectedLanguage 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(EntitiesDocumentResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesDocumentResultWithDetectedLanguage(document.RootElement, options); + } + + internal static EntitiesDocumentResultWithDetectedLanguage DeserializeEntitiesDocumentResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntity.DeserializeNamedEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesDocumentResultWithDetectedLanguage( + id, + warnings, + statistics, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + EntitiesDocumentResultWithDetectedLanguage 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 DeserializeEntitiesDocumentResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithDetectedLanguage)} 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 EntitiesDocumentResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesDocumentResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..1587011a22225 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the entity recognition task result for the document with detected language. + public partial class EntitiesDocumentResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Recognized entities in the document. + /// , or is null. + internal EntitiesDocumentResultWithDetectedLanguage(string id, IEnumerable warnings, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal EntitiesDocumentResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntitiesDocumentResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Recognized entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..6ac971c90befd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntitiesDocumentResultWithMetadataDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntitiesDocumentResultWithMetadataDetectedLanguage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(document.RootElement, options); + } + + internal static EntitiesDocumentResultWithMetadataDetectedLanguage DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntityWithMetadata.DeserializeNamedEntityWithMetadata(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesDocumentResultWithMetadataDetectedLanguage( + id, + warnings, + statistics, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + EntitiesDocumentResultWithMetadataDetectedLanguage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesDocumentResultWithMetadataDetectedLanguage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntitiesDocumentResultWithMetadataDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.cs new file mode 100644 index 0000000000000..7fb44030b3b17 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesDocumentResultWithMetadataDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the entity recognition task result for the document with metadata and detected language. + public partial class EntitiesDocumentResultWithMetadataDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Recognized entities in the document. + /// , or is null. + internal EntitiesDocumentResultWithMetadataDetectedLanguage(string id, IEnumerable warnings, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal EntitiesDocumentResultWithMetadataDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntitiesDocumentResultWithMetadataDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Recognized entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.Serialization.cs new file mode 100644 index 0000000000000..76798617a53d9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntitiesOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + EntitiesOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesOperationAction(document.RootElement, options); + } + + internal static EntitiesOperationAction DeserializeEntitiesOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntitiesActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntitiesActionContent.DeserializeEntitiesActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support writing '{options.Format}' format."); + } + } + + EntitiesOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntitiesOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.cs new file mode 100644 index 0000000000000..c5f7bebea25e6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the task definition for an Entities Recognition task. + public partial class EntitiesOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public EntitiesOperationAction() + { + Kind = AnalyzeTextOperationActionKind.EntityRecognition; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal EntitiesOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, EntitiesActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public EntitiesActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.Serialization.cs new file mode 100644 index 0000000000000..8253a59b46b87 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntitiesResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + EntitiesResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntitiesResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntitiesResult(document.RootElement, options); + } + + internal static EntitiesResult DeserializeEntitiesResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntitiesDocumentResultWithMetadataDetectedLanguage.DeserializeEntitiesDocumentResultWithMetadataDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntitiesResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntitiesResult)} does not support writing '{options.Format}' format."); + } + } + + EntitiesResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntitiesResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntitiesResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntitiesResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntitiesResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.cs new file mode 100644 index 0000000000000..3dd5ff59a253e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntitiesResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the entity recognition task result. + public partial class EntitiesResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal EntitiesResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal EntitiesResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntitiesResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityCategory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityCategory.cs new file mode 100644 index 0000000000000..179a18f17addd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityCategory.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains all the entity categories detected by entity recognition. + public readonly partial struct EntityCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EntityCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddressValue = "Address"; + private const string NumericValue = "Numeric"; + private const string AgeValue = "Age"; + private const string CurrencyValue = "Currency"; + private const string NumberValue = "Number"; + private const string NumberRangeValue = "NumberRange"; + private const string PercentageValue = "Percentage"; + private const string OrdinalValue = "Ordinal"; + private const string TemperatureValue = "Temperature"; + private const string DimensionValue = "Dimension"; + private const string LengthValue = "Length"; + private const string WeightValue = "Weight"; + private const string HeightValue = "Height"; + private const string SpeedValue = "Speed"; + private const string AreaValue = "Area"; + private const string VolumeValue = "Volume"; + private const string InformationValue = "Information"; + private const string TemporalValue = "Temporal"; + private const string DateValue = "Date"; + private const string TimeValue = "Time"; + private const string DateTimeValue = "DateTime"; + private const string DateRangeValue = "DateRange"; + private const string TimeRangeValue = "TimeRange"; + private const string DateTimeRangeValue = "DateTimeRange"; + private const string DurationValue = "Duration"; + private const string SetTemporalValue = "SetTemporal"; + private const string EventValue = "Event"; + private const string SportsEventValue = "SportsEvent"; + private const string CulturalEventValue = "CulturalEvent"; + private const string NaturalEventValue = "NaturalEvent"; + private const string LocationValue = "Location"; + private const string GeoPoliticalEntityValue = "GPE"; + private const string CityValue = "City"; + private const string StateValue = "State"; + private const string CountryRegionValue = "CountryRegion"; + private const string ContinentValue = "Continent"; + private const string StructuralValue = "Structural"; + private const string AirportValue = "Airport"; + private const string GeologicalValue = "Geological"; + private const string OrganizationValue = "Organization"; + private const string OrganizationMedicalValue = "OrganizationMedical"; + private const string OrganizationStockExchangeValue = "OrganizationStockExchange"; + private const string OrganizationSportsValue = "OrganizationSports"; + private const string PersonValue = "Person"; + private const string PersonTypeValue = "PersonType"; + private const string EmailValue = "Email"; + private const string UriValue = "URL"; + private const string IpAddressValue = "IP"; + private const string PhoneNumberValue = "PhoneNumber"; + private const string ProductValue = "Product"; + private const string ComputingProductValue = "ComputingProduct"; + private const string SkillValue = "Skill"; + + /// Specific street-level mentions of locations: house/building numbers, streets, avenues, highways, intersections referenced by name. + public static EntityCategory Address { get; } = new EntityCategory(AddressValue); + /// Numeric values, including digits and number words. + public static EntityCategory Numeric { get; } = new EntityCategory(NumericValue); + /// Age-related values. + public static EntityCategory Age { get; } = new EntityCategory(AgeValue); + /// Currency-related values. + public static EntityCategory Currency { get; } = new EntityCategory(CurrencyValue); + /// Numbers without a unit. + public static EntityCategory Number { get; } = new EntityCategory(NumberValue); + /// Range of Numbers. + public static EntityCategory NumberRange { get; } = new EntityCategory(NumberRangeValue); + /// Percentage-related values. + public static EntityCategory Percentage { get; } = new EntityCategory(PercentageValue); + /// Ordinal numbers. + public static EntityCategory Ordinal { get; } = new EntityCategory(OrdinalValue); + /// Temperature-related values. + public static EntityCategory Temperature { get; } = new EntityCategory(TemperatureValue); + /// Dimension of measurements. + public static EntityCategory Dimension { get; } = new EntityCategory(DimensionValue); + /// Length of an object. + public static EntityCategory Length { get; } = new EntityCategory(LengthValue); + /// Weight of an object. + public static EntityCategory Weight { get; } = new EntityCategory(WeightValue); + /// Height of an object. + public static EntityCategory Height { get; } = new EntityCategory(HeightValue); + /// Speed of an object. + public static EntityCategory Speed { get; } = new EntityCategory(SpeedValue); + /// Area of an object. + public static EntityCategory Area { get; } = new EntityCategory(AreaValue); + /// Volume of an object. + public static EntityCategory Volume { get; } = new EntityCategory(VolumeValue); + /// Unit of measure for digital information. + public static EntityCategory Information { get; } = new EntityCategory(InformationValue); + /// Items relating to time. + public static EntityCategory Temporal { get; } = new EntityCategory(TemporalValue); + /// Calendar dates. + public static EntityCategory Date { get; } = new EntityCategory(DateValue); + /// Times of day. + public static EntityCategory Time { get; } = new EntityCategory(TimeValue); + /// Calendar dates with time. + public static EntityCategory DateTime { get; } = new EntityCategory(DateTimeValue); + /// Range of dates. + public static EntityCategory DateRange { get; } = new EntityCategory(DateRangeValue); + /// Range of times. + public static EntityCategory TimeRange { get; } = new EntityCategory(TimeRangeValue); + /// Range of date and time. + public static EntityCategory DateTimeRange { get; } = new EntityCategory(DateTimeRangeValue); + /// Duration of time. + public static EntityCategory Duration { get; } = new EntityCategory(DurationValue); + /// Set of time-related values. + public static EntityCategory SetTemporal { get; } = new EntityCategory(SetTemporalValue); + /// Social, sports, business, political, educational, natural, historical, criminal, violent, legal, military events with a timed period. + public static EntityCategory Event { get; } = new EntityCategory(EventValue); + /// Sports event-related values. + public static EntityCategory SportsEvent { get; } = new EntityCategory(SportsEventValue); + /// Cultural event-related values. + public static EntityCategory CulturalEvent { get; } = new EntityCategory(CulturalEventValue); + /// Natural event-related values. + public static EntityCategory NaturalEvent { get; } = new EntityCategory(NaturalEventValue); + /// Particular point or place in physical space. + public static EntityCategory Location { get; } = new EntityCategory(LocationValue); + /// Cities, countries/regions, states. + public static EntityCategory GeoPoliticalEntity { get; } = new EntityCategory(GeoPoliticalEntityValue); + /// City-related values. + public static EntityCategory City { get; } = new EntityCategory(CityValue); + /// State-related values. + public static EntityCategory State { get; } = new EntityCategory(StateValue); + /// Country or region-related values. + public static EntityCategory CountryRegion { get; } = new EntityCategory(CountryRegionValue); + /// Continent-related values. + public static EntityCategory Continent { get; } = new EntityCategory(ContinentValue); + /// Manmade structures. + public static EntityCategory Structural { get; } = new EntityCategory(StructuralValue); + /// Airports. + public static EntityCategory Airport { get; } = new EntityCategory(AirportValue); + /// Geographic and natural features such as rivers, oceans, and deserts. + public static EntityCategory Geological { get; } = new EntityCategory(GeologicalValue); + /// Corporations, agencies, and other groups of people defined by some established organizational structure. These labels can include companies, political parties/movements, musical bands, sport clubs, government bodies, and public organizations. Nationalities or religions are not ORGANIZATION. + public static EntityCategory Organization { get; } = new EntityCategory(OrganizationValue); + /// Medical companies and groups. + public static EntityCategory OrganizationMedical { get; } = new EntityCategory(OrganizationMedicalValue); + /// Stock exchange groups. + public static EntityCategory OrganizationStockExchange { get; } = new EntityCategory(OrganizationStockExchangeValue); + /// Sports-related organizations. + public static EntityCategory OrganizationSports { get; } = new EntityCategory(OrganizationSportsValue); + /// First, last, and middle names, names of fictional characters, and aliases. Titles, such as 'Mr.' or 'President', are not considered part of the named entity. + public static EntityCategory Person { get; } = new EntityCategory(PersonValue); + /// Human roles classified by a group membership. + public static EntityCategory PersonType { get; } = new EntityCategory(PersonTypeValue); + /// Email addresses. + public static EntityCategory Email { get; } = new EntityCategory(EmailValue); + /// URLs to websites. + public static EntityCategory Uri { get; } = new EntityCategory(UriValue); + /// network IP addresses. + public static EntityCategory IpAddress { get; } = new EntityCategory(IpAddressValue); + /// Phone numbers (US and EU phone numbers only). + public static EntityCategory PhoneNumber { get; } = new EntityCategory(PhoneNumberValue); + /// Single or group of commercial, consumable objects, electronics, vehicles, food groups. + public static EntityCategory Product { get; } = new EntityCategory(ProductValue); + /// Computing products. + public static EntityCategory ComputingProduct { get; } = new EntityCategory(ComputingProductValue); + /// A capability, skill, or expertise. + public static EntityCategory Skill { get; } = new EntityCategory(SkillValue); + /// Determines if two values are the same. + public static bool operator ==(EntityCategory left, EntityCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EntityCategory left, EntityCategory right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EntityCategory(string value) => new EntityCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EntityCategory other && Equals(other); + /// + public bool Equals(EntityCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.Serialization.cs new file mode 100644 index 0000000000000..084c3a651f4e5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.Serialization.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + [PersistableModelProxy(typeof(UnknownEntityComponentInformation))] + public partial class EntityComponentInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("entityComponentKind"u8); + writer.WriteStringValue(EntityComponentKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityComponentInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + + internal static EntityComponentInformation DeserializeEntityComponentInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("entityComponentKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "LearnedComponent": return LearnedComponent.DeserializeLearnedComponent(element, options); + case "ListComponent": return ListComponent.DeserializeListComponent(element, options); + case "PrebuiltComponent": return PrebuiltComponent.DeserializePrebuiltComponent(element, options); + } + } + return UnknownEntityComponentInformation.DeserializeUnknownEntityComponentInformation(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{options.Format}' format."); + } + } + + EntityComponentInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityComponentInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityComponentInformation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.cs new file mode 100644 index 0000000000000..d2c4de97c7385 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentInformation.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// This object contains information of the detected entity components. The possible component types may expand in the future. Parsing code should handle unexpected values gracefully + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class EntityComponentInformation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected EntityComponentInformation() + { + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + internal EntityComponentInformation(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData) + { + EntityComponentKind = entityComponentKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Kind of entity component. + internal EntityComponentKind EntityComponentKind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentKind.cs new file mode 100644 index 0000000000000..5ddde86b8dda4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityComponentKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Kind of entity components supported. + internal readonly partial struct EntityComponentKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EntityComponentKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrebuiltComponentValue = "PrebuiltComponent"; + private const string LearnedComponentValue = "LearnedComponent"; + private const string ListComponentValue = "ListComponent"; + + /// Prebuilt component. + public static EntityComponentKind PrebuiltComponent { get; } = new EntityComponentKind(PrebuiltComponentValue); + /// Learned component. + public static EntityComponentKind LearnedComponent { get; } = new EntityComponentKind(LearnedComponentValue); + /// List component. + public static EntityComponentKind ListComponent { get; } = new EntityComponentKind(ListComponentValue); + /// Determines if two values are the same. + public static bool operator ==(EntityComponentKind left, EntityComponentKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EntityComponentKind left, EntityComponentKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EntityComponentKind(string value) => new EntityComponentKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EntityComponentKind other && Equals(other); + /// + public bool Equals(EntityComponentKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.Serialization.cs new file mode 100644 index 0000000000000..4e368ba319924 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityInferenceConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ExcludeNormalizedValues)) + { + writer.WritePropertyName("excludeNormalizedValues"u8); + writer.WriteBooleanValue(ExcludeNormalizedValues.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityInferenceConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityInferenceConfig(document.RootElement, options); + } + + internal static EntityInferenceConfig DeserializeEntityInferenceConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? excludeNormalizedValues = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("excludeNormalizedValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + excludeNormalizedValues = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityInferenceConfig(excludeNormalizedValues, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support writing '{options.Format}' format."); + } + } + + EntityInferenceConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityInferenceConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityInferenceConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityInferenceConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityInferenceConfig(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.cs new file mode 100644 index 0000000000000..caeebf189212c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityInferenceConfig.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The class that houses the inference options allowed for named entity recognition. + public partial class EntityInferenceConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EntityInferenceConfig() + { + } + + /// Initializes a new instance of . + /// Option to include/exclude the detected entity values to be normalized and included in the metadata. The numeric and temporal entity types support value normalization. + /// Keeps track of any properties unknown to the library. + internal EntityInferenceConfig(bool? excludeNormalizedValues, IDictionary serializedAdditionalRawData) + { + ExcludeNormalizedValues = excludeNormalizedValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Option to include/exclude the detected entity values to be normalized and included in the metadata. The numeric and temporal entity types support value normalization. + public bool? ExcludeNormalizedValues { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.Serialization.cs new file mode 100644 index 0000000000000..953d6ef49ca0d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityLinkingActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support writing '{format}' format."); + } + + 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(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityLinkingActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingActionContent(document.RootElement, options); + } + + internal static EntityLinkingActionContent DeserializeEntityLinkingActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingActionContent(loggingOptOut, modelVersion, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.cs new file mode 100644 index 0000000000000..43b1c0e00709f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingActionContent.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for an Entity Linking task. + public partial class EntityLinkingActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EntityLinkingActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + /// Keeps track of any properties unknown to the library. + internal EntityLinkingActionContent(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Optional parameter to provide the string index type used to interpret string offsets. Defaults to TextElements (Graphemes). + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.Serialization.cs new file mode 100644 index 0000000000000..e0b8172af2db9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityLinkingMatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support writing '{format}' format."); + } + + writer.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); + 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 + } + } + writer.WriteEndObject(); + } + + EntityLinkingMatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingMatch(document.RootElement, options); + } + + internal static EntityLinkingMatch DeserializeEntityLinkingMatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double confidenceScore = default; + string text = default; + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingMatch(confidenceScore, text, offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingMatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingMatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingMatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingMatch FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingMatch(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.cs new file mode 100644 index 0000000000000..e6d303bf101b8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingMatch.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The Match object containing the detected entity text with the offset and the length. + public partial class EntityLinkingMatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + /// Entity text as appears in the request. + /// Start position for the entity match text. + /// Length for the entity match text. + /// is null. + internal EntityLinkingMatch(double confidenceScore, string text, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + + ConfidenceScore = confidenceScore; + Text = text; + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + /// Entity text as appears in the request. + /// Start position for the entity match text. + /// Length for the entity match text. + /// Keeps track of any properties unknown to the library. + internal EntityLinkingMatch(double confidenceScore, string text, int offset, int length, IDictionary serializedAdditionalRawData) + { + ConfidenceScore = confidenceScore; + Text = text; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingMatch() + { + } + + /// If a well known item is recognized, a decimal number denoting the confidence level between 0 and 1 will be returned. + public double ConfidenceScore { get; } + /// Entity text as appears in the request. + public string Text { get; } + /// Start position for the entity match text. + public int Offset { get; } + /// Length for the entity match text. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.Serialization.cs new file mode 100644 index 0000000000000..046208f0456d1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityLinkingOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + EntityLinkingOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingOperationAction(document.RootElement, options); + } + + internal static EntityLinkingOperationAction DeserializeEntityLinkingOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityLinkingActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntityLinkingActionContent.DeserializeEntityLinkingActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntityLinkingOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.cs new file mode 100644 index 0000000000000..50b711e5a2851 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text Entity linking LRO task. + public partial class EntityLinkingOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public EntityLinkingOperationAction() + { + Kind = AnalyzeTextOperationActionKind.EntityLinking; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Task parameters. + internal EntityLinkingOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, EntityLinkingActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Task parameters. + public EntityLinkingActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.Serialization.cs new file mode 100644 index 0000000000000..820918815b5f9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityLinkingOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityLinkingOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingOperationResult(document.RootElement, options); + } + + internal static EntityLinkingOperationResult DeserializeEntityLinkingOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityLinkingResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntityLinkingResult.DeserializeEntityLinkingResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntityLinkingOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.cs new file mode 100644 index 0000000000000..ddfe9b6095485 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text Entity linking task LRO result. + public partial class EntityLinkingOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Entity linking result. + /// is null. + internal EntityLinkingOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, EntityLinkingResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.EntityLinkingOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Entity linking result. + internal EntityLinkingOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, EntityLinkingResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingOperationResult() + { + } + + /// Entity linking result. + public EntityLinkingResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.Serialization.cs new file mode 100644 index 0000000000000..4e5aff440ec0c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityLinkingResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + EntityLinkingResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingResult(document.RootElement, options); + } + + internal static EntityLinkingResult DeserializeEntityLinkingResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityLinkingResultWithDetectedLanguage.DeserializeEntityLinkingResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityLinkingResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityLinkingResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.cs new file mode 100644 index 0000000000000..d609871070d43 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Entity linking result. + public partial class EntityLinkingResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal EntityLinkingResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal EntityLinkingResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..e19cc855fe9dd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityLinkingResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityLinkingResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityLinkingResultWithDetectedLanguage 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(EntityLinkingResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityLinkingResultWithDetectedLanguage(document.RootElement, options); + } + + internal static EntityLinkingResultWithDetectedLanguage DeserializeEntityLinkingResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LinkedEntity.DeserializeLinkedEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityLinkingResultWithDetectedLanguage( + id, + warnings, + statistics, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityLinkingResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + EntityLinkingResultWithDetectedLanguage 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 DeserializeEntityLinkingResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityLinkingResultWithDetectedLanguage)} 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 EntityLinkingResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityLinkingResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..b69dc3b8652f4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityLinkingResultWithDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Entity linking document result with auto language detection. + public partial class EntityLinkingResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Recognized well known entities in the document. + /// , or is null. + internal EntityLinkingResultWithDetectedLanguage(string id, IEnumerable warnings, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Recognized well known entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal EntityLinkingResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityLinkingResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Recognized well known entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.Serialization.cs new file mode 100644 index 0000000000000..063699ded70ca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.Serialization.cs @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + [PersistableModelProxy(typeof(UnknownEntityOverlapPolicy))] + public partial class EntityOverlapPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + EntityOverlapPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + + internal static EntityOverlapPolicy DeserializeEntityOverlapPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("policyKind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "allowOverlap": return AllowOverlapEntityPolicyType.DeserializeAllowOverlapEntityPolicyType(element, options); + case "matchLongest": return MatchLongestEntityPolicyType.DeserializeMatchLongestEntityPolicyType(element, options); + } + } + return UnknownEntityOverlapPolicy.DeserializeUnknownEntityOverlapPolicy(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{options.Format}' format."); + } + } + + EntityOverlapPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityOverlapPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityOverlapPolicy(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.cs new file mode 100644 index 0000000000000..4c152a24a70e8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityOverlapPolicy.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// + /// The abstract base class for entity OverlapPolicy. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class EntityOverlapPolicy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected EntityOverlapPolicy() + { + } + + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal EntityOverlapPolicy(PolicyKind policyKind, IDictionary serializedAdditionalRawData) + { + PolicyKind = policyKind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The entity OverlapPolicy object kind. + internal PolicyKind PolicyKind { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 0000000000000..20fb317d72651 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityRecognitionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityRecognitionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityRecognitionOperationResult(document.RootElement, options); + } + + internal static EntityRecognitionOperationResult DeserializeEntityRecognitionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntitiesResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = EntitiesResult.DeserializeEntitiesResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + EntityRecognitionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityRecognitionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityRecognitionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new EntityRecognitionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityRecognitionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.cs new file mode 100644 index 0000000000000..fe82902951381 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityRecognitionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the entity recognition job task result. + public partial class EntityRecognitionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results for the task. + /// is null. + internal EntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, EntitiesResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.EntityRecognitionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results for the task. + internal EntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, EntitiesResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal EntityRecognitionOperationResult() + { + } + + /// Results for the task. + public EntitiesResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.Serialization.cs new file mode 100644 index 0000000000000..45c88700ea9c6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class EntityTag : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityTag)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(ConfidenceScore)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityTag IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityTag)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityTag(document.RootElement, options); + } + + internal static EntityTag DeserializeEntityTag(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + double? confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EntityTag(name, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityTag)} does not support writing '{options.Format}' format."); + } + } + + EntityTag IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityTag(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityTag)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EntityTag FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeEntityTag(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.cs new file mode 100644 index 0000000000000..0b2585091cab4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/EntityTag.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Entity tag object which contains the name of the tags abd any associated confidence score. Entity Tags are used to express some similarities/affinity between entities. + public partial class EntityTag + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the tag. Entity Tag names will be unique globally. + /// is null. + internal EntityTag(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// Name of the tag. Entity Tag names will be unique globally. + /// Detection score between 0 and 1 of the extracted entity. + /// Keeps track of any properties unknown to the library. + internal EntityTag(string name, double? confidenceScore, IDictionary serializedAdditionalRawData) + { + Name = name; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EntityTag() + { + } + + /// Name of the tag. Entity Tag names will be unique globally. + public string Name { get; } + /// Detection score between 0 and 1 of the extracted entity. + public double? ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..75e444901fce6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ExtractedSummaryDocumentResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummaryDocumentResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("sentences"u8); + writer.WriteStartArray(); + foreach (var item in Sentences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ExtractedSummaryDocumentResultWithDetectedLanguage 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(ExtractedSummaryDocumentResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractedSummaryDocumentResultWithDetectedLanguage(document.RootElement, options); + } + + internal static ExtractedSummaryDocumentResultWithDetectedLanguage DeserializeExtractedSummaryDocumentResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList sentences = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExtractedSummarySentence.DeserializeExtractedSummarySentence(item, options)); + } + sentences = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractedSummaryDocumentResultWithDetectedLanguage( + id, + warnings, + statistics, + sentences, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractedSummaryDocumentResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + ExtractedSummaryDocumentResultWithDetectedLanguage 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 DeserializeExtractedSummaryDocumentResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractedSummaryDocumentResultWithDetectedLanguage)} 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 ExtractedSummaryDocumentResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractedSummaryDocumentResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..dd3c38645e357 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummaryDocumentResultWithDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// A ranked list of sentences representing the extracted summary. + public partial class ExtractedSummaryDocumentResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Specifies the the extracted sentences from the input document. + /// , or is null. + internal ExtractedSummaryDocumentResultWithDetectedLanguage(string id, IEnumerable warnings, IEnumerable sentences) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(sentences, nameof(sentences)); + + Id = id; + Warnings = warnings.ToList(); + Sentences = sentences.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Specifies the the extracted sentences from the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal ExtractedSummaryDocumentResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList sentences, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Sentences = sentences; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtractedSummaryDocumentResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Specifies the the extracted sentences from the input document. + public IReadOnlyList Sentences { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.Serialization.cs new file mode 100644 index 0000000000000..953a3b8559367 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ExtractedSummarySentence : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support writing '{format}' format."); + } + + writer.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); + 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 + } + } + writer.WriteEndObject(); + } + + ExtractedSummarySentence IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractedSummarySentence(document.RootElement, options); + } + + internal static ExtractedSummarySentence DeserializeExtractedSummarySentence(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + double rankScore = default; + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("rankScore"u8)) + { + rankScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractedSummarySentence(text, rankScore, offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support writing '{options.Format}' format."); + } + } + + ExtractedSummarySentence IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractedSummarySentence(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractedSummarySentence)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractedSummarySentence FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractedSummarySentence(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.cs new file mode 100644 index 0000000000000..eac177f231e7b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractedSummarySentence.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents an extracted sentences from the input document. + public partial class ExtractedSummarySentence + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The extracted sentence text. + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + /// The length of the sentence. + /// is null. + internal ExtractedSummarySentence(string text, double rankScore, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + RankScore = rankScore; + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// The extracted sentence text. + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + /// The length of the sentence. + /// Keeps track of any properties unknown to the library. + internal ExtractedSummarySentence(string text, double rankScore, int offset, int length, IDictionary serializedAdditionalRawData) + { + Text = text; + RankScore = rankScore; + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtractedSummarySentence() + { + } + + /// The extracted sentence text. + public string Text { get; } + /// A double value representing the relevance of the sentence within the summary. Higher values indicate higher importance. + public double RankScore { get; } + /// The sentence offset from the start of the document, based on the value of the parameter StringIndexType. + public int Offset { get; } + /// The length of the sentence. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.Serialization.cs new file mode 100644 index 0000000000000..e828beec04cdc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ExtractiveSummarizationActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + 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); + 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 + } + } + writer.WriteEndObject(); + } + + ExtractiveSummarizationActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationActionContent(document.RootElement, options); + } + + internal static ExtractiveSummarizationActionContent DeserializeExtractiveSummarizationActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + long? sentenceCount = default; + ExtractiveSummarizationSortingCriteria? sortBy = default; + StringIndexType? stringIndexType = default; + string query = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sentenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("sortBy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sortBy = new ExtractiveSummarizationSortingCriteria(property.Value.GetString()); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("query"u8)) + { + query = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationActionContent( + loggingOptOut, + modelVersion, + sentenceCount, + sortBy, + stringIndexType, + query, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractiveSummarizationActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.cs new file mode 100644 index 0000000000000..a63ae61a1010b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationActionContent.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for an Extractive Summarization task. + public partial class ExtractiveSummarizationActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ExtractiveSummarizationActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Specifies the number of sentences in the extracted summary. + /// Specifies how to sort the extracted summaries. + /// Specifies the method used to interpret string offsets. + /// (Optional) If provided, the query will be used to extract most relevant sentences from the document. + /// Keeps track of any properties unknown to the library. + internal ExtractiveSummarizationActionContent(bool? loggingOptOut, string modelVersion, long? sentenceCount, ExtractiveSummarizationSortingCriteria? sortBy, StringIndexType? stringIndexType, string query, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + SentenceCount = sentenceCount; + SortBy = sortBy; + StringIndexType = stringIndexType; + Query = query; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Specifies the number of sentences in the extracted summary. + public long? SentenceCount { get; set; } + /// Specifies how to sort the extracted summaries. + public ExtractiveSummarizationSortingCriteria? SortBy { get; set; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + /// (Optional) If provided, the query will be used to extract most relevant sentences from the document. + public string Query { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.Serialization.cs new file mode 100644 index 0000000000000..d82b440b7a651 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ExtractiveSummarizationOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + ExtractiveSummarizationOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationOperationAction(document.RootElement, options); + } + + internal static ExtractiveSummarizationOperationAction DeserializeExtractiveSummarizationOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExtractiveSummarizationActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = ExtractiveSummarizationActionContent.DeserializeExtractiveSummarizationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ExtractiveSummarizationOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.cs new file mode 100644 index 0000000000000..2917f6ea653c0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the task definition for an Extractive Summarization task. + public partial class ExtractiveSummarizationOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public ExtractiveSummarizationOperationAction() + { + Kind = AnalyzeTextOperationActionKind.ExtractiveSummarization; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Extractive Summarization task. + internal ExtractiveSummarizationOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, ExtractiveSummarizationActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Extractive Summarization task. + public ExtractiveSummarizationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.Serialization.cs new file mode 100644 index 0000000000000..6593695901b0f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ExtractiveSummarizationOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ExtractiveSummarizationOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationOperationResult(document.RootElement, options); + } + + internal static ExtractiveSummarizationOperationResult DeserializeExtractiveSummarizationOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExtractiveSummarizationResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = ExtractiveSummarizationResult.DeserializeExtractiveSummarizationResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ExtractiveSummarizationOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.cs new file mode 100644 index 0000000000000..8b1f294085255 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the results for an Extractive Summarization task. + public partial class ExtractiveSummarizationOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.ExtractiveSummarizationOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal ExtractiveSummarizationOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, ExtractiveSummarizationResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal ExtractiveSummarizationOperationResult() + { + } + + /// Results of the task. + public ExtractiveSummarizationResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs new file mode 100644 index 0000000000000..754e81c3d6d7f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ExtractiveSummarizationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + ExtractiveSummarizationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExtractiveSummarizationResult(document.RootElement, options); + } + + internal static ExtractiveSummarizationResult DeserializeExtractiveSummarizationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExtractedSummaryDocumentResultWithDetectedLanguage.DeserializeExtractedSummaryDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExtractiveSummarizationResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support writing '{options.Format}' format."); + } + } + + ExtractiveSummarizationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExtractiveSummarizationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExtractiveSummarizationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ExtractiveSummarizationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeExtractiveSummarizationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.cs new file mode 100644 index 0000000000000..2b5b5c5df356c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the pre-built Extractive Summarization results of each document. + public partial class ExtractiveSummarizationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal ExtractiveSummarizationResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal ExtractiveSummarizationResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExtractiveSummarizationResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationSortingCriteria.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationSortingCriteria.cs new file mode 100644 index 0000000000000..50d818608a086 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ExtractiveSummarizationSortingCriteria.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// 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 string to a . + public static implicit operator ExtractiveSummarizationSortingCriteria(string value) => new ExtractiveSummarizationSortingCriteria(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExtractiveSummarizationSortingCriteria other && Equals(other); + /// + public bool Equals(ExtractiveSummarizationSortingCriteria other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.Serialization.cs new file mode 100644 index 0000000000000..96041ecceaa5d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.Serialization.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class FhirBundle : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FhirBundle)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + foreach (var item in AdditionalProperties) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + + FhirBundle IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FhirBundle)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFhirBundle(document.RootElement, options); + } + + internal static FhirBundle DeserializeFhirBundle(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + additionalProperties = additionalPropertiesDictionary; + return new FhirBundle(additionalProperties); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FhirBundle)} does not support writing '{options.Format}' format."); + } + } + + FhirBundle IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFhirBundle(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FhirBundle)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static FhirBundle FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeFhirBundle(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.cs new file mode 100644 index 0000000000000..87c38c4107255 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirBundle.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + public partial class FhirBundle + { + /// Initializes a new instance of . + internal FhirBundle() + { + AdditionalProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Additional Properties. + internal FhirBundle(IReadOnlyDictionary additionalProperties) + { + AdditionalProperties = additionalProperties; + } + + /// + /// Additional Properties + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IReadOnlyDictionary AdditionalProperties { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirVersion.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirVersion.cs new file mode 100644 index 0000000000000..62e57345baf4b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/FhirVersion.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The FHIR Spec version. + public readonly partial struct FhirVersion : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FhirVersion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string _401Value = "4.0.1"; + + /// Version 4.0.1. + public static FhirVersion _401 { get; } = new FhirVersion(_401Value); + /// Determines if two values are the same. + public static bool operator ==(FhirVersion left, FhirVersion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FhirVersion left, FhirVersion right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FhirVersion(string value) => new FhirVersion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FhirVersion other && Equals(other); + /// + public bool Equals(FhirVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.Serialization.cs new file mode 100644 index 0000000000000..4539c1161773f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.Serialization.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support writing '{format}' format."); + } + + 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(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsDefined(FhirVersion)) + { + writer.WritePropertyName("fhirVersion"u8); + writer.WriteStringValue(FhirVersion.Value.ToString()); + } + if (Optional.IsDefined(DocumentType)) + { + writer.WritePropertyName("documentType"u8); + writer.WriteStringValue(DocumentType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareActionContent(document.RootElement, options); + } + + internal static HealthcareActionContent DeserializeHealthcareActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + StringIndexType? stringIndexType = default; + FhirVersion? fhirVersion = default; + HealthcareDocumentType? documentType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("fhirVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fhirVersion = new FhirVersion(property.Value.GetString()); + continue; + } + if (property.NameEquals("documentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + documentType = new HealthcareDocumentType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareActionContent( + loggingOptOut, + modelVersion, + stringIndexType, + fhirVersion, + documentType, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support writing '{options.Format}' format."); + } + } + + HealthcareActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.cs new file mode 100644 index 0000000000000..f1336a7d50e0a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareActionContent.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Healthcare task. + public partial class HealthcareActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public HealthcareActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Specifies the method used to interpret string offsets. + /// The FHIR Spec version that the result will use to format the fhirBundle. For additional information see https://www.hl7.org/fhir/overview.html. + /// Document type that can be provided as input for Fhir Documents. Expect to have fhirVersion provided when used. Behavior of using None enum is the same as not using the documentType parameter. + /// Keeps track of any properties unknown to the library. + internal HealthcareActionContent(bool? loggingOptOut, string modelVersion, StringIndexType? stringIndexType, FhirVersion? fhirVersion, HealthcareDocumentType? documentType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + StringIndexType = stringIndexType; + FhirVersion = fhirVersion; + DocumentType = documentType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + /// The FHIR Spec version that the result will use to format the fhirBundle. For additional information see https://www.hl7.org/fhir/overview.html. + public FhirVersion? FhirVersion { get; set; } + /// Document type that can be provided as input for Fhir Documents. Expect to have fhirVersion provided when used. Behavior of using None enum is the same as not using the documentType parameter. + public HealthcareDocumentType? DocumentType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.Serialization.cs new file mode 100644 index 0000000000000..180ffcf3d08b2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.Serialization.cs @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareAssertion : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support writing '{format}' format."); + } + + 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()); + } + if (Optional.IsDefined(Temporality)) + { + writer.WritePropertyName("temporality"u8); + writer.WriteStringValue(Temporality.Value.ToSerialString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareAssertion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareAssertion(document.RootElement, options); + } + + internal static HealthcareAssertion DeserializeHealthcareAssertion(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthcareAssertionConditionality? conditionality = default; + HealthcareAssertionCertainty? certainty = default; + HealthcareAssertionAssociation? association = default; + HealthcareAssertionTemporality? temporality = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conditionality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + conditionality = property.Value.GetString().ToHealthcareAssertionConditionality(); + continue; + } + if (property.NameEquals("certainty"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certainty = property.Value.GetString().ToHealthcareAssertionCertainty(); + continue; + } + if (property.NameEquals("association"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + association = property.Value.GetString().ToHealthcareAssertionAssociation(); + continue; + } + if (property.NameEquals("temporality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + temporality = property.Value.GetString().ToHealthcareAssertionTemporality(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareAssertion(conditionality, certainty, association, temporality, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support writing '{options.Format}' format."); + } + } + + HealthcareAssertion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareAssertion(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareAssertion)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareAssertion FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareAssertion(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.cs new file mode 100644 index 0000000000000..fa508b0a0d837 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertion.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Assertion of the entity. + public partial class HealthcareAssertion + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal HealthcareAssertion() + { + } + + /// Initializes a new instance of . + /// Describes any conditionality on the entity. + /// Describes the entities certainty and polarity. + /// Describes if the entity is the subject of the text or if it describes someone else. + /// Describes temporal information regarding the entity. + /// Keeps track of any properties unknown to the library. + internal HealthcareAssertion(HealthcareAssertionConditionality? conditionality, HealthcareAssertionCertainty? certainty, HealthcareAssertionAssociation? association, HealthcareAssertionTemporality? temporality, IDictionary serializedAdditionalRawData) + { + Conditionality = conditionality; + Certainty = certainty; + Association = association; + Temporality = temporality; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Describes any conditionality on the entity. + public HealthcareAssertionConditionality? Conditionality { get; } + /// Describes the entities certainty and polarity. + public HealthcareAssertionCertainty? Certainty { get; } + /// Describes if the entity is the subject of the text or if it describes someone else. + public HealthcareAssertionAssociation? Association { get; } + /// Describes temporal information regarding the entity. + public HealthcareAssertionTemporality? Temporality { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.Serialization.cs new file mode 100644 index 0000000000000..0f9e0239411f1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class HealthcareAssertionAssociationExtensions + { + public static string ToSerialString(this HealthcareAssertionAssociation value) => value switch + { + HealthcareAssertionAssociation.Subject => "subject", + HealthcareAssertionAssociation.Other => "other", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionAssociation value.") + }; + + public static HealthcareAssertionAssociation ToHealthcareAssertionAssociation(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "subject")) return HealthcareAssertionAssociation.Subject; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "other")) return HealthcareAssertionAssociation.Other; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionAssociation value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.cs new file mode 100644 index 0000000000000..edbb32b443589 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionAssociation.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// Describes if the entity is the subject of the text or if it describes someone else. + public enum HealthcareAssertionAssociation + { + /// Subject association. + Subject, + /// Other association. + Other + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.Serialization.cs new file mode 100644 index 0000000000000..d01ce7841f117 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class HealthcareAssertionCertaintyExtensions + { + public static string ToSerialString(this HealthcareAssertionCertainty value) => value switch + { + HealthcareAssertionCertainty.Positive => "positive", + HealthcareAssertionCertainty.PositivePossible => "positivePossible", + HealthcareAssertionCertainty.NeutralPossible => "neutralPossible", + HealthcareAssertionCertainty.NegativePossible => "negativePossible", + HealthcareAssertionCertainty.Negative => "negative", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionCertainty value.") + }; + + public static HealthcareAssertionCertainty ToHealthcareAssertionCertainty(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return HealthcareAssertionCertainty.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positivePossible")) return HealthcareAssertionCertainty.PositivePossible; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "neutralPossible")) return HealthcareAssertionCertainty.NeutralPossible; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negativePossible")) return HealthcareAssertionCertainty.NegativePossible; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return HealthcareAssertionCertainty.Negative; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionCertainty value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.cs new file mode 100644 index 0000000000000..66b0e276da989 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionCertainty.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// Describes the entities certainty and polarity. + public enum HealthcareAssertionCertainty + { + /// Positive certainty. + Positive, + /// Possibly positive certainty. + PositivePossible, + /// Possibly neutral certainty. + NeutralPossible, + /// Possibly negative certainty. + NegativePossible, + /// Negative certainty. + Negative + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.Serialization.cs new file mode 100644 index 0000000000000..64e8691f98a72 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class HealthcareAssertionConditionalityExtensions + { + public static string ToSerialString(this HealthcareAssertionConditionality value) => value switch + { + HealthcareAssertionConditionality.Hypothetical => "hypothetical", + HealthcareAssertionConditionality.Conditional => "conditional", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionConditionality value.") + }; + + public static HealthcareAssertionConditionality ToHealthcareAssertionConditionality(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "hypothetical")) return HealthcareAssertionConditionality.Hypothetical; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "conditional")) return HealthcareAssertionConditionality.Conditional; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionConditionality value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.cs new file mode 100644 index 0000000000000..73b19712da780 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionConditionality.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// Describes any conditionality on the entity. + public enum HealthcareAssertionConditionality + { + /// Hypothetical conditionality. + Hypothetical, + /// Conditional conditionality. + Conditional + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.Serialization.cs new file mode 100644 index 0000000000000..434b58ff575ec --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class HealthcareAssertionTemporalityExtensions + { + public static string ToSerialString(this HealthcareAssertionTemporality value) => value switch + { + HealthcareAssertionTemporality.Current => "current", + HealthcareAssertionTemporality.Past => "past", + HealthcareAssertionTemporality.Future => "future", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionTemporality value.") + }; + + public static HealthcareAssertionTemporality ToHealthcareAssertionTemporality(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "current")) return HealthcareAssertionTemporality.Current; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "past")) return HealthcareAssertionTemporality.Past; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "future")) return HealthcareAssertionTemporality.Future; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown HealthcareAssertionTemporality value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.cs new file mode 100644 index 0000000000000..26fd96531f7ce --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareAssertionTemporality.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// Describes temporal information regarding the entity. + public enum HealthcareAssertionTemporality + { + /// Current temporality. + Current, + /// Past temporality. + Past, + /// Future temporality. + Future + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareDocumentType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareDocumentType.cs new file mode 100644 index 0000000000000..ccd1c5be61a9a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareDocumentType.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Document type. + public readonly partial struct HealthcareDocumentType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HealthcareDocumentType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ClinicalTrialValue = "ClinicalTrial"; + private const string DischargeSummaryValue = "DischargeSummary"; + private const string ProgressNoteValue = "ProgressNote"; + private const string HistoryAndPhysicalValue = "HistoryAndPhysical"; + private const string ConsultValue = "Consult"; + private const string ImagingValue = "Imaging"; + private const string PathologyValue = "Pathology"; + private const string ProcedureNoteValue = "ProcedureNote"; + + /// None document type. + public static HealthcareDocumentType None { get; } = new HealthcareDocumentType(NoneValue); + /// Clinical trial document type. + public static HealthcareDocumentType ClinicalTrial { get; } = new HealthcareDocumentType(ClinicalTrialValue); + /// Discharge summary document type. + public static HealthcareDocumentType DischargeSummary { get; } = new HealthcareDocumentType(DischargeSummaryValue); + /// Progress note document type. + public static HealthcareDocumentType ProgressNote { get; } = new HealthcareDocumentType(ProgressNoteValue); + /// History and physical document type. + public static HealthcareDocumentType HistoryAndPhysical { get; } = new HealthcareDocumentType(HistoryAndPhysicalValue); + /// Consult document type. + public static HealthcareDocumentType Consult { get; } = new HealthcareDocumentType(ConsultValue); + /// Imaging document type. + public static HealthcareDocumentType Imaging { get; } = new HealthcareDocumentType(ImagingValue); + /// Pathology document type. + public static HealthcareDocumentType Pathology { get; } = new HealthcareDocumentType(PathologyValue); + /// Procedure note document type. + public static HealthcareDocumentType ProcedureNote { get; } = new HealthcareDocumentType(ProcedureNoteValue); + /// Determines if two values are the same. + public static bool operator ==(HealthcareDocumentType left, HealthcareDocumentType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HealthcareDocumentType left, HealthcareDocumentType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HealthcareDocumentType(string value) => new HealthcareDocumentType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HealthcareDocumentType other && Equals(other); + /// + public bool Equals(HealthcareDocumentType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..b34b2194c65df --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.Serialization.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("relations"u8); + writer.WriteStartArray(); + foreach (var item in Relations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(FhirBundle)) + { + writer.WritePropertyName("fhirBundle"u8); + writer.WriteObjectValue(FhirBundle, options); + } + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage 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(HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(document.RootElement, options); + } + + internal static HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage DeserializeHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList entities = default; + IReadOnlyList relations = default; + FhirBundle fhirBundle = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntity.DeserializeHealthcareEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelation.DeserializeHealthcareRelation(item, options)); + } + relations = array; + continue; + } + if (property.NameEquals("fhirBundle"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + fhirBundle = FhirBundle.DeserializeFhirBundle(property.Value, options); + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage( + id, + warnings, + statistics, + entities, + relations, + fhirBundle, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage 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 DeserializeHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage)} 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 HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs new file mode 100644 index 0000000000000..814aab96ecda0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Result object for the processed Healthcare document with detected language. + public partial class HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Healthcare entities. + /// Healthcare entity relations. + /// , , or is null. + internal HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id, IEnumerable warnings, IEnumerable entities, IEnumerable relations) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(entities, nameof(entities)); + Argument.AssertNotNull(relations, nameof(relations)); + + Id = id; + Warnings = warnings.ToList(); + Entities = entities.ToList(); + Relations = relations.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Healthcare entities. + /// Healthcare entity relations. + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList entities, IReadOnlyList relations, FhirBundle fhirBundle, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Entities = entities; + Relations = relations; + FhirBundle = fhirBundle; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Healthcare entities. + public IReadOnlyList Entities { get; } + /// Healthcare entity relations. + public IReadOnlyList Relations { get; } + /// JSON bundle containing a FHIR compatible object for consumption in other Healthcare tools. For additional information see https://www.hl7.org/fhir/overview.html. + public FhirBundle FhirBundle { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.Serialization.cs new file mode 100644 index 0000000000000..b5ed585ffe307 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.Serialization.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support writing '{format}' format."); + } + + writer.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, options); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Links)) + { + writer.WritePropertyName("links"u8); + writer.WriteStartArray(); + foreach (var item in Links) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareEntity(document.RootElement, options); + } + + internal static HealthcareEntity DeserializeHealthcareEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + HealthcareEntityCategory category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + HealthcareAssertion assertion = default; + string name = default; + IReadOnlyList links = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = new HealthcareEntityCategory(property.Value.GetString()); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("assertion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + assertion = HealthcareAssertion.DeserializeHealthcareAssertion(property.Value, options); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("links"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntityLink.DeserializeHealthcareEntityLink(item, options)); + } + links = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + assertion, + name, + links ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support writing '{options.Format}' format."); + } + } + + HealthcareEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.cs new file mode 100644 index 0000000000000..c8a8e92cdc31e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntity.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Healthcare entity extracted from the document. + public partial class HealthcareEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// is null. + internal HealthcareEntity(string text, HealthcareEntityCategory category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Links = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Healthcare Entity Category. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Assertion of the entity. + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + /// Entity references in known data sources. + /// Keeps track of any properties unknown to the library. + internal HealthcareEntity(string text, HealthcareEntityCategory category, string subcategory, int offset, int length, double confidenceScore, HealthcareAssertion assertion, string name, IReadOnlyList links, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Assertion = assertion; + Name = name; + Links = links; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Healthcare Entity Category. + public HealthcareEntityCategory Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + /// Assertion of the entity. + public HealthcareAssertion Assertion { get; } + /// Preferred name for the entity. Example: 'histologically' would have a 'name' of 'histologic'. + public string Name { get; } + /// Entity references in known data sources. + public IReadOnlyList Links { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityCategory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityCategory.cs new file mode 100644 index 0000000000000..eec69e77a71fd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityCategory.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Healthcare Entity Category. + public readonly partial struct HealthcareEntityCategory : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HealthcareEntityCategory(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BodyStructureValue = "BodyStructure"; + private const string AgeValue = "Age"; + private const string GenderValue = "Gender"; + private const string ExaminationNameValue = "ExaminationName"; + private const string DateValue = "Date"; + private const string DirectionValue = "Direction"; + private const string FrequencyValue = "Frequency"; + private const string MeasurementValueValue = "MeasurementValue"; + private const string MeasurementUnitValue = "MeasurementUnit"; + private const string RelationalOperatorValue = "RelationalOperator"; + private const string TimeValue = "Time"; + private const string GeneOrProteinValue = "GeneOrProtein"; + private const string VariantValue = "Variant"; + private const string AdministrativeEventValue = "AdministrativeEvent"; + private const string CareEnvironmentValue = "CareEnvironment"; + private const string HealthcareProfessionValue = "HealthcareProfession"; + private const string DiagnosisValue = "Diagnosis"; + private const string SymptomOrSignValue = "SymptomOrSign"; + private const string ConditionQualifierValue = "ConditionQualifier"; + private const string MedicationClassValue = "MedicationClass"; + private const string MedicationNameValue = "MedicationName"; + private const string DosageValue = "Dosage"; + private const string MedicationFormValue = "MedicationForm"; + private const string MedicationRouteValue = "MedicationRoute"; + private const string FamilyRelationValue = "FamilyRelation"; + private const string TreatmentNameValue = "TreatmentName"; + private const string EthnicityValue = "Ethnicity"; + private const string CourseValue = "Course"; + private const string ExpressionValue = "Expression"; + private const string MutationTypeValue = "MutationType"; + private const string ConditionScaleValue = "ConditionScale"; + private const string AllergenValue = "Allergen"; + private const string EmploymentValue = "Employment"; + private const string LivingStatusValue = "LivingStatus"; + private const string SubstanceUseValue = "SubstanceUse"; + private const string SubstanceUseAmountValue = "SubstanceUseAmount"; + + /// Body structure. + public static HealthcareEntityCategory BodyStructure { get; } = new HealthcareEntityCategory(BodyStructureValue); + /// Age. + public static HealthcareEntityCategory Age { get; } = new HealthcareEntityCategory(AgeValue); + /// Gender. + public static HealthcareEntityCategory Gender { get; } = new HealthcareEntityCategory(GenderValue); + /// Examination name. + public static HealthcareEntityCategory ExaminationName { get; } = new HealthcareEntityCategory(ExaminationNameValue); + /// Date. + public static HealthcareEntityCategory Date { get; } = new HealthcareEntityCategory(DateValue); + /// Direction. + public static HealthcareEntityCategory Direction { get; } = new HealthcareEntityCategory(DirectionValue); + /// Frequency. + public static HealthcareEntityCategory Frequency { get; } = new HealthcareEntityCategory(FrequencyValue); + /// Measurement value. + public static HealthcareEntityCategory MeasurementValue { get; } = new HealthcareEntityCategory(MeasurementValueValue); + /// Measurement unit. + public static HealthcareEntityCategory MeasurementUnit { get; } = new HealthcareEntityCategory(MeasurementUnitValue); + /// Relational operator. + public static HealthcareEntityCategory RelationalOperator { get; } = new HealthcareEntityCategory(RelationalOperatorValue); + /// Time. + public static HealthcareEntityCategory Time { get; } = new HealthcareEntityCategory(TimeValue); + /// Gene or protein. + public static HealthcareEntityCategory GeneOrProtein { get; } = new HealthcareEntityCategory(GeneOrProteinValue); + /// Variant. + public static HealthcareEntityCategory Variant { get; } = new HealthcareEntityCategory(VariantValue); + /// Administrative event. + public static HealthcareEntityCategory AdministrativeEvent { get; } = new HealthcareEntityCategory(AdministrativeEventValue); + /// Care environment. + public static HealthcareEntityCategory CareEnvironment { get; } = new HealthcareEntityCategory(CareEnvironmentValue); + /// Healthcare profession. + public static HealthcareEntityCategory HealthcareProfession { get; } = new HealthcareEntityCategory(HealthcareProfessionValue); + /// Diagnosis. + public static HealthcareEntityCategory Diagnosis { get; } = new HealthcareEntityCategory(DiagnosisValue); + /// Symptom or sign. + public static HealthcareEntityCategory SymptomOrSign { get; } = new HealthcareEntityCategory(SymptomOrSignValue); + /// Condition qualifier. + public static HealthcareEntityCategory ConditionQualifier { get; } = new HealthcareEntityCategory(ConditionQualifierValue); + /// Medication class. + public static HealthcareEntityCategory MedicationClass { get; } = new HealthcareEntityCategory(MedicationClassValue); + /// Medication name. + public static HealthcareEntityCategory MedicationName { get; } = new HealthcareEntityCategory(MedicationNameValue); + /// Dosage. + public static HealthcareEntityCategory Dosage { get; } = new HealthcareEntityCategory(DosageValue); + /// Medication form. + public static HealthcareEntityCategory MedicationForm { get; } = new HealthcareEntityCategory(MedicationFormValue); + /// Medication route. + public static HealthcareEntityCategory MedicationRoute { get; } = new HealthcareEntityCategory(MedicationRouteValue); + /// Family relation. + public static HealthcareEntityCategory FamilyRelation { get; } = new HealthcareEntityCategory(FamilyRelationValue); + /// Treatment name. + public static HealthcareEntityCategory TreatmentName { get; } = new HealthcareEntityCategory(TreatmentNameValue); + /// Ethnicity. + public static HealthcareEntityCategory Ethnicity { get; } = new HealthcareEntityCategory(EthnicityValue); + /// Course. + public static HealthcareEntityCategory Course { get; } = new HealthcareEntityCategory(CourseValue); + /// Expression. + public static HealthcareEntityCategory Expression { get; } = new HealthcareEntityCategory(ExpressionValue); + /// Mutation type. + public static HealthcareEntityCategory MutationType { get; } = new HealthcareEntityCategory(MutationTypeValue); + /// Condition scale. + public static HealthcareEntityCategory ConditionScale { get; } = new HealthcareEntityCategory(ConditionScaleValue); + /// Allergen. + public static HealthcareEntityCategory Allergen { get; } = new HealthcareEntityCategory(AllergenValue); + /// Employment. + public static HealthcareEntityCategory Employment { get; } = new HealthcareEntityCategory(EmploymentValue); + /// Living status. + public static HealthcareEntityCategory LivingStatus { get; } = new HealthcareEntityCategory(LivingStatusValue); + /// Substance use. + public static HealthcareEntityCategory SubstanceUse { get; } = new HealthcareEntityCategory(SubstanceUseValue); + /// Substance use amount. + public static HealthcareEntityCategory SubstanceUseAmount { get; } = new HealthcareEntityCategory(SubstanceUseAmountValue); + /// Determines if two values are the same. + public static bool operator ==(HealthcareEntityCategory left, HealthcareEntityCategory right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HealthcareEntityCategory left, HealthcareEntityCategory right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator HealthcareEntityCategory(string value) => new HealthcareEntityCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HealthcareEntityCategory other && Equals(other); + /// + public bool Equals(HealthcareEntityCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.Serialization.cs new file mode 100644 index 0000000000000..12e362bbcc9ca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareEntityLink : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("dataSource"u8); + writer.WriteStringValue(DataSource); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareEntityLink IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareEntityLink(document.RootElement, options); + } + + internal static HealthcareEntityLink DeserializeHealthcareEntityLink(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string dataSource = default; + string id = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dataSource"u8)) + { + dataSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareEntityLink(dataSource, id, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support writing '{options.Format}' format."); + } + } + + HealthcareEntityLink IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareEntityLink(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareEntityLink)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareEntityLink FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareEntityLink(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.cs new file mode 100644 index 0000000000000..a687959250637 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareEntityLink.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Reference to an entity in known data sources. + public partial class HealthcareEntityLink + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + /// Entity id in the given source catalog. + /// or is null. + internal HealthcareEntityLink(string dataSource, string id) + { + Argument.AssertNotNull(dataSource, nameof(dataSource)); + Argument.AssertNotNull(id, nameof(id)); + + DataSource = dataSource; + Id = id; + } + + /// Initializes a new instance of . + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + /// Entity id in the given source catalog. + /// Keeps track of any properties unknown to the library. + internal HealthcareEntityLink(string dataSource, string id, IDictionary serializedAdditionalRawData) + { + DataSource = dataSource; + Id = id; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareEntityLink() + { + } + + /// Entity Catalog. Examples include: UMLS, CHV, MSH, etc. + public string DataSource { get; } + /// Entity id in the given source catalog. + public string Id { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.Serialization.cs new file mode 100644 index 0000000000000..b63103dbe2b5c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + HealthcareOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareOperationAction(document.RootElement, options); + } + + internal static HealthcareOperationAction DeserializeHealthcareOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthcareActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = HealthcareActionContent.DeserializeHealthcareActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support writing '{options.Format}' format."); + } + } + + HealthcareOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new HealthcareOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.cs new file mode 100644 index 0000000000000..2e65f3e38a6ae --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The long running task to be performed by the service on the Healthcare input documents. + public partial class HealthcareOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public HealthcareOperationAction() + { + Kind = AnalyzeTextOperationActionKind.Healthcare; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Healthcare task. + internal HealthcareOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, HealthcareActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Healthcare task. + public HealthcareActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.Serialization.cs new file mode 100644 index 0000000000000..70eafbd5dc06b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareOperationResult(document.RootElement, options); + } + + internal static HealthcareOperationResult DeserializeHealthcareOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthcareResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = HealthcareResult.DeserializeHealthcareResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support writing '{options.Format}' format."); + } + } + + HealthcareOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new HealthcareOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.cs new file mode 100644 index 0000000000000..dbf8deaafe8cc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Healthcare Analyze Text long tunning operation result object. + public partial class HealthcareOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// Results of the task. + /// is null. + internal HealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, HealthcareResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.HealthcareOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// Results of the task. + internal HealthcareOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, HealthcareResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareOperationResult() + { + } + + /// Results of the task. + public HealthcareResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.Serialization.cs new file mode 100644 index 0000000000000..8c4391bfc97ca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.Serialization.cs @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareRelation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("relationType"u8); + writer.WriteStringValue(RelationType.ToString()); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(ConfidenceScore)) + { + writer.WritePropertyName("confidenceScore"u8); + writer.WriteNumberValue(ConfidenceScore.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareRelation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareRelation(document.RootElement, options); + } + + internal static HealthcareRelation DeserializeHealthcareRelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RelationType relationType = default; + IReadOnlyList entities = default; + double? confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("relationType"u8)) + { + relationType = new RelationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareRelationEntity.DeserializeHealthcareRelationEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareRelation(relationType, entities, confidenceScore, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support writing '{options.Format}' format."); + } + } + + HealthcareRelation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareRelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareRelation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareRelation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareRelation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.cs new file mode 100644 index 0000000000000..6d50ef1481802 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelation.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Every relation is an entity graph of a certain relationType, where all entities are connected and have specific roles within the relation context. + public partial class HealthcareRelation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + /// The entities in the relation. + /// is null. + internal HealthcareRelation(RelationType relationType, IEnumerable entities) + { + Argument.AssertNotNull(entities, nameof(entities)); + + RelationType = relationType; + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + /// The entities in the relation. + /// Confidence score between 0 and 1 of the extracted relation. + /// Keeps track of any properties unknown to the library. + internal HealthcareRelation(RelationType relationType, IReadOnlyList entities, double? confidenceScore, IDictionary serializedAdditionalRawData) + { + RelationType = relationType; + Entities = entities; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareRelation() + { + } + + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + public RelationType RelationType { get; } + /// The entities in the relation. + public IReadOnlyList Entities { get; } + /// Confidence score between 0 and 1 of the extracted relation. + public double? ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.Serialization.cs new file mode 100644 index 0000000000000..f03d17a7144ac --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareRelationEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("ref"u8); + writer.WriteStringValue(Ref); + writer.WritePropertyName("role"u8); + writer.WriteStringValue(Role); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HealthcareRelationEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareRelationEntity(document.RootElement, options); + } + + internal static HealthcareRelationEntity DeserializeHealthcareRelationEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @ref = default; + string role = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ref"u8)) + { + @ref = property.Value.GetString(); + continue; + } + if (property.NameEquals("role"u8)) + { + role = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareRelationEntity(@ref, role, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support writing '{options.Format}' format."); + } + } + + HealthcareRelationEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareRelationEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareRelationEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareRelationEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareRelationEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.cs new file mode 100644 index 0000000000000..70a23fc4e845c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareRelationEntity.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Entity in the relation. + public partial class HealthcareRelationEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + /// or is null. + internal HealthcareRelationEntity(string @ref, string role) + { + Argument.AssertNotNull(@ref, nameof(@ref)); + Argument.AssertNotNull(role, nameof(role)); + + Ref = @ref; + Role = role; + } + + /// Initializes a new instance of . + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + /// Keeps track of any properties unknown to the library. + internal HealthcareRelationEntity(string @ref, string role, IDictionary serializedAdditionalRawData) + { + Ref = @ref; + Role = role; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareRelationEntity() + { + } + + /// Reference link object, using a JSON pointer RFC 6901 (URI Fragment Identifier Representation), pointing to the entity . + public string Ref { get; } + /// Role of entity in the relationship. For example: 'CD20-positive diffuse large B-cell lymphoma' has the following entities with their roles in parenthesis: CD20 (GeneOrProtein), Positive (Expression), diffuse large B-cell lymphoma (Diagnosis). + public string Role { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.Serialization.cs new file mode 100644 index 0000000000000..fbff35bbb78c8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class HealthcareResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + HealthcareResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HealthcareResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthcareResult(document.RootElement, options); + } + + internal static HealthcareResult DeserializeHealthcareResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(HealthcareEntitiesDocumentResultWithDocumentDetectedLanguage.DeserializeHealthcareEntitiesDocumentResultWithDocumentDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthcareResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(HealthcareResult)} does not support writing '{options.Format}' format."); + } + } + + HealthcareResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthcareResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthcareResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HealthcareResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHealthcareResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.cs new file mode 100644 index 0000000000000..733a11d7c80e0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/HealthcareResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Result object for the processed Healthcare task. + public partial class HealthcareResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// List of result objects for the processed Healthcare documents. + /// , or is null. + internal HealthcareResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// List of result objects for the processed Healthcare documents. + /// Keeps track of any properties unknown to the library. + internal HealthcareResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthcareResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// List of result objects for the processed Healthcare documents. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.Serialization.cs new file mode 100644 index 0000000000000..00acae2c92b56 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class InformationMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InformationMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + InformationMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InformationMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInformationMetadata(document.RootElement, options); + } + + internal static InformationMetadata DeserializeInformationMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + InformationUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new InformationUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InformationMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InformationMetadata)} does not support writing '{options.Format}' format."); + } + } + + InformationMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInformationMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InformationMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new InformationMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInformationMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.cs new file mode 100644 index 0000000000000..6a48ffaf7393f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Information (data) entity Metadata model. + public partial class InformationMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for information. + internal InformationMetadata(double value, InformationUnit unit) + { + MetadataKind = MetadataKind.InformationMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for information. + internal InformationMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, InformationUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal InformationMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for information. + public InformationUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationUnit.cs new file mode 100644 index 0000000000000..2b6c81a8e518e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InformationUnit.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The information (data) Unit of measurement. + public readonly partial struct InformationUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InformationUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string BitValue = "Bit"; + private const string KilobitValue = "Kilobit"; + private const string MegabitValue = "Megabit"; + private const string GigabitValue = "Gigabit"; + private const string TerabitValue = "Terabit"; + private const string PetabitValue = "Petabit"; + private const string ByteValue = "Byte"; + private const string KilobyteValue = "Kilobyte"; + private const string MegabyteValue = "Megabyte"; + private const string GigabyteValue = "Gigabyte"; + private const string TerabyteValue = "Terabyte"; + private const string PetabyteValue = "Petabyte"; + + /// Unspecified data size unit. + public static InformationUnit Unspecified { get; } = new InformationUnit(UnspecifiedValue); + /// Data size unit in bits. + public static InformationUnit Bit { get; } = new InformationUnit(BitValue); + /// Data size unit in kilobits. + public static InformationUnit Kilobit { get; } = new InformationUnit(KilobitValue); + /// Data size unit in megabits. + public static InformationUnit Megabit { get; } = new InformationUnit(MegabitValue); + /// Data size unit in gigabits. + public static InformationUnit Gigabit { get; } = new InformationUnit(GigabitValue); + /// Data size unit in terabits. + public static InformationUnit Terabit { get; } = new InformationUnit(TerabitValue); + /// Data size unit in petabits. + public static InformationUnit Petabit { get; } = new InformationUnit(PetabitValue); + /// Data size unit in bytes. + public static InformationUnit Byte { get; } = new InformationUnit(ByteValue); + /// Data size unit in kilobytes. + public static InformationUnit Kilobyte { get; } = new InformationUnit(KilobyteValue); + /// Data size unit in megabytes. + public static InformationUnit Megabyte { get; } = new InformationUnit(MegabyteValue); + /// Data size unit in gigabytes. + public static InformationUnit Gigabyte { get; } = new InformationUnit(GigabyteValue); + /// Data size unit in terabytes. + public static InformationUnit Terabyte { get; } = new InformationUnit(TerabyteValue); + /// Data size unit in petabytes. + public static InformationUnit Petabyte { get; } = new InformationUnit(PetabyteValue); + /// Determines if two values are the same. + public static bool operator ==(InformationUnit left, InformationUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InformationUnit left, InformationUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator InformationUnit(string value) => new InformationUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InformationUnit other && Equals(other); + /// + public bool Equals(InformationUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorCode.cs new file mode 100644 index 0000000000000..02f145a1b975c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorCode.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// 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 string to a . + public static implicit operator InnerErrorCode(string value) => new InnerErrorCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InnerErrorCode other && Equals(other); + /// + public bool Equals(InnerErrorCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.Serialization.cs new file mode 100644 index 0000000000000..355a1a93e5c44 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.Serialization.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class InnerErrorModel : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.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, 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 + } + } + writer.WriteEndObject(); + } + + InnerErrorModel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInnerErrorModel(document.RootElement, options); + } + + internal static InnerErrorModel DeserializeInnerErrorModel(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InnerErrorCode code = default; + string message = default; + IReadOnlyDictionary details = default; + string target = default; + InnerErrorModel innererror = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = new InnerErrorCode(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + details = dictionary; + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("innererror"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + innererror = DeserializeInnerErrorModel(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InnerErrorModel( + code, + message, + details ?? new ChangeTrackingDictionary(), + target, + innererror, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support writing '{options.Format}' format."); + } + } + + InnerErrorModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInnerErrorModel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InnerErrorModel)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InnerErrorModel FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInnerErrorModel(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.cs new file mode 100644 index 0000000000000..66499c328d532 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/InnerErrorModel.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. + public partial class InnerErrorModel + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// Error message. + /// is null. + internal InnerErrorModel(InnerErrorCode code, string message) + { + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + Details = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// One of a server-defined set of error codes. + /// Error message. + /// Error details. + /// Error target. + /// An object containing more specific information than the current object about the error. + /// Keeps track of any properties unknown to the library. + internal InnerErrorModel(InnerErrorCode code, string message, IReadOnlyDictionary details, string target, InnerErrorModel innererror, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Details = details; + Target = target; + Innererror = innererror; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InnerErrorModel() + { + } + + /// One of a server-defined set of error codes. + public InnerErrorCode Code { get; } + /// Error message. + public string Message { get; } + /// Error details. + public IReadOnlyDictionary Details { get; } + /// Error target. + public string Target { get; } + /// An object containing more specific information than the current object about the error. + public InnerErrorModel Innererror { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.Serialization.cs new file mode 100644 index 0000000000000..34d26cd92b64b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class KeyPhraseActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support writing '{format}' format."); + } + + 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 (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 + } + } + writer.WriteEndObject(); + } + + KeyPhraseActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseActionContent(document.RootElement, options); + } + + internal static KeyPhraseActionContent DeserializeKeyPhraseActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseActionContent(loggingOptOut, modelVersion, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static KeyPhraseActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.cs new file mode 100644 index 0000000000000..007fbbac5e89b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseActionContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Key Phrase Extraction task. + public partial class KeyPhraseActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public KeyPhraseActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Keeps track of any properties unknown to the library. + internal KeyPhraseActionContent(bool? loggingOptOut, string modelVersion, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.Serialization.cs new file mode 100644 index 0000000000000..0f41c776bf53f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class KeyPhraseExtractionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + KeyPhraseExtractionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseExtractionOperationResult(document.RootElement, options); + } + + internal static KeyPhraseExtractionOperationResult DeserializeKeyPhraseExtractionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyPhraseResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = KeyPhraseResult.DeserializeKeyPhraseResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseExtractionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseExtractionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseExtractionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseExtractionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new KeyPhraseExtractionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseExtractionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.cs new file mode 100644 index 0000000000000..5121953051edc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseExtractionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text KeyPhraseExtraction LRO task. + public partial class KeyPhraseExtractionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// The list of Key phrase extraction results. + /// is null. + internal KeyPhraseExtractionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, KeyPhraseResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.KeyPhraseExtractionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// The list of Key phrase extraction results. + internal KeyPhraseExtractionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, KeyPhraseResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal KeyPhraseExtractionOperationResult() + { + } + + /// The list of Key phrase extraction results. + public KeyPhraseResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.Serialization.cs new file mode 100644 index 0000000000000..fde37c34ba264 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class KeyPhraseOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + KeyPhraseOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseOperationAction(document.RootElement, options); + } + + internal static KeyPhraseOperationAction DeserializeKeyPhraseOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyPhraseActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = KeyPhraseActionContent.DeserializeKeyPhraseActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new KeyPhraseOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.cs new file mode 100644 index 0000000000000..213fc13c8b3ed --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the task definition for a Key Phrase Extraction task. + public partial class KeyPhraseOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public KeyPhraseOperationAction() + { + Kind = AnalyzeTextOperationActionKind.KeyPhraseExtraction; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Key phrase extraction task parameters. + internal KeyPhraseOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, KeyPhraseActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Key phrase extraction task parameters. + public KeyPhraseActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.Serialization.cs new file mode 100644 index 0000000000000..4d24fd83ca9b9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class KeyPhraseResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + KeyPhraseResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhraseResult(document.RootElement, options); + } + + internal static KeyPhraseResult DeserializeKeyPhraseResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KeyPhrasesDocumentResultWithDetectedLanguage.DeserializeKeyPhrasesDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhraseResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support writing '{options.Format}' format."); + } + } + + KeyPhraseResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKeyPhraseResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhraseResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static KeyPhraseResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhraseResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.cs new file mode 100644 index 0000000000000..33d9a9576aec8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhraseResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the KeyPhraseResult. + public partial class KeyPhraseResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal KeyPhraseResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal KeyPhraseResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyPhraseResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..dd3ab42fe284c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class KeyPhrasesDocumentResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyPhrasesDocumentResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("keyPhrases"u8); + writer.WriteStartArray(); + foreach (var item in KeyPhrases) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + KeyPhrasesDocumentResultWithDetectedLanguage 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(KeyPhrasesDocumentResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyPhrasesDocumentResultWithDetectedLanguage(document.RootElement, options); + } + + internal static KeyPhrasesDocumentResultWithDetectedLanguage DeserializeKeyPhrasesDocumentResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + IReadOnlyList keyPhrases = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("keyPhrases"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + keyPhrases = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyPhrasesDocumentResultWithDetectedLanguage( + id, + warnings, + statistics, + keyPhrases, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyPhrasesDocumentResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + KeyPhrasesDocumentResultWithDetectedLanguage 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 DeserializeKeyPhrasesDocumentResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyPhrasesDocumentResultWithDetectedLanguage)} 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 KeyPhrasesDocumentResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeKeyPhrasesDocumentResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..2cccf3d4f9c7d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/KeyPhrasesDocumentResultWithDetectedLanguage.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// A ranked list of sentences representing the extracted summary. + public partial class KeyPhrasesDocumentResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + /// , or is null. + internal KeyPhrasesDocumentResultWithDetectedLanguage(string id, IEnumerable warnings, IEnumerable keyPhrases) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(keyPhrases, nameof(keyPhrases)); + + Id = id; + Warnings = warnings.ToList(); + KeyPhrases = keyPhrases.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal KeyPhrasesDocumentResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, IReadOnlyList keyPhrases, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + KeyPhrases = keyPhrases; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyPhrasesDocumentResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// A list of representative words or phrases. The number of key phrases returned is proportional to the number of words in the input document. + public IReadOnlyList KeyPhrases { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.Serialization.cs new file mode 100644 index 0000000000000..83f4bc7f68a79 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LanguageDetectionActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support writing '{format}' format."); + } + + 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 (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 + } + } + writer.WriteEndObject(); + } + + LanguageDetectionActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionActionContent(document.RootElement, options); + } + + internal static LanguageDetectionActionContent DeserializeLanguageDetectionActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionActionContent(loggingOptOut, modelVersion, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.cs new file mode 100644 index 0000000000000..e81b708bcb89f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionActionContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Language Detection task. + public partial class LanguageDetectionActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LanguageDetectionActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionActionContent(bool? loggingOptOut, string modelVersion, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs new file mode 100644 index 0000000000000..a124d0f20c4e6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LanguageDetectionDocumentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + LanguageDetectionDocumentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionDocumentResult(document.RootElement, options); + } + + internal static LanguageDetectionDocumentResult DeserializeLanguageDetectionDocumentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionDocumentResult(id, warnings, statistics, detectedLanguage, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionDocumentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionDocumentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionDocumentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionDocumentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionDocumentResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.cs new file mode 100644 index 0000000000000..097b868938f92 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionDocumentResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the language detection for a document. + public partial class LanguageDetectionDocumentResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Detected Language. + /// , or is null. + internal LanguageDetectionDocumentResult(string id, IEnumerable warnings, DetectedLanguage detectedLanguage) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(detectedLanguage, nameof(detectedLanguage)); + + Id = id; + Warnings = warnings.ToList(); + DetectedLanguage = detectedLanguage; + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Detected Language. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionDocumentResult(string id, IReadOnlyList warnings, DocumentStatistics statistics, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LanguageDetectionDocumentResult() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Detected Language. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.Serialization.cs new file mode 100644 index 0000000000000..6e7c9fba143d4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LanguageDetectionResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + LanguageDetectionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionResult(document.RootElement, options); + } + + internal static LanguageDetectionResult DeserializeLanguageDetectionResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LanguageDetectionDocumentResult.DeserializeLanguageDetectionDocumentResult(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.cs new file mode 100644 index 0000000000000..61b7a842e1bb5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the language detection result for the request. + public partial class LanguageDetectionResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Enumeration of language detection results for each input document. + /// , or is null. + internal LanguageDetectionResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Enumeration of language detection results for each input document. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LanguageDetectionResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Enumeration of language detection results for each input document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.Serialization.cs new file mode 100644 index 0000000000000..da86ba9306620 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LanguageDetectionTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + LanguageDetectionTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageDetectionTextInput(document.RootElement, options); + } + + internal static LanguageDetectionTextInput DeserializeLanguageDetectionTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LanguageInput.DeserializeLanguageInput(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageDetectionTextInput(documents ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support writing '{options.Format}' format."); + } + } + + LanguageDetectionTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageDetectionTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageDetectionTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageDetectionTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageDetectionTextInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.cs new file mode 100644 index 0000000000000..59b39852cf3dc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageDetectionTextInput.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the language detection document analysis input. + public partial class LanguageDetectionTextInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public LanguageDetectionTextInput() + { + Documents = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of documents to be analyzed. + /// Keeps track of any properties unknown to the library. + internal LanguageDetectionTextInput(IList documents, IDictionary serializedAdditionalRawData) + { + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of documents to be analyzed. + public IList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.Serialization.cs new file mode 100644 index 0000000000000..e9f7f0ce1e221 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LanguageInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (Optional.IsDefined(CountryHint)) + { + writer.WritePropertyName("countryHint"u8); + writer.WriteStringValue(CountryHint); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + LanguageInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LanguageInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLanguageInput(document.RootElement, options); + } + + internal static LanguageInput DeserializeLanguageInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string text = default; + string countryHint = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryHint"u8)) + { + countryHint = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LanguageInput(id, text, countryHint, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LanguageInput)} does not support writing '{options.Format}' format."); + } + } + + LanguageInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLanguageInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LanguageInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LanguageInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLanguageInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.cs new file mode 100644 index 0000000000000..8a217ba15a3d1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LanguageInput.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the language detection input. + public partial class LanguageInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// or is null. + public LanguageInput(string id, string text) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(text, nameof(text)); + + Id = id; + Text = text; + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// The country hint to help with language detection of the text. + /// Keeps track of any properties unknown to the library. + internal LanguageInput(string id, string text, string countryHint, IDictionary serializedAdditionalRawData) + { + Id = id; + Text = text; + CountryHint = countryHint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LanguageInput() + { + } + + /// A unique, non-empty document identifier. + public string Id { get; } + /// The input text to process. + public string Text { get; } + /// The country hint to help with language detection of the text. + public string CountryHint { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.Serialization.cs new file mode 100644 index 0000000000000..fac32b518b57e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LearnedComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LearnedComponent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WritePropertyName("entityComponentKind"u8); + writer.WriteStringValue(EntityComponentKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + LearnedComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LearnedComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLearnedComponent(document.RootElement, options); + } + + internal static LearnedComponent DeserializeLearnedComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + EntityComponentKind entityComponentKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LearnedComponent(entityComponentKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LearnedComponent)} does not support writing '{options.Format}' format."); + } + } + + LearnedComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLearnedComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LearnedComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LearnedComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLearnedComponent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.cs new file mode 100644 index 0000000000000..9af9280138588 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LearnedComponent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// This object contains information of the learned component of the detected entity. + public partial class LearnedComponent : EntityComponentInformation + { + /// Initializes a new instance of . + internal LearnedComponent() + { + EntityComponentKind = EntityComponentKind.LearnedComponent; + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + /// The learned component of an extracted entity type. + internal LearnedComponent(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData, string value) : base(entityComponentKind, serializedAdditionalRawData) + { + Value = value; + } + + /// The learned component of an extracted entity type. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.Serialization.cs new file mode 100644 index 0000000000000..361193fc38778 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LengthMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LengthMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + LengthMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LengthMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLengthMetadata(document.RootElement, options); + } + + internal static LengthMetadata DeserializeLengthMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + LengthUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new LengthUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LengthMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LengthMetadata)} does not support writing '{options.Format}' format."); + } + } + + LengthMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLengthMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LengthMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LengthMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLengthMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.cs new file mode 100644 index 0000000000000..2b33333d0558a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Length entity Metadata model. + public partial class LengthMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for length. + internal LengthMetadata(double value, LengthUnit unit) + { + MetadataKind = MetadataKind.LengthMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for length. + internal LengthMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, LengthUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal LengthMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for length. + public LengthUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthUnit.cs new file mode 100644 index 0000000000000..4169531f64c4c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LengthUnit.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The length unit of measurement. + public readonly partial struct LengthUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LengthUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string KilometerValue = "Kilometer"; + private const string HectometerValue = "Hectometer"; + private const string DecameterValue = "Decameter"; + private const string MeterValue = "Meter"; + private const string DecimeterValue = "Decimeter"; + private const string CentimeterValue = "Centimeter"; + private const string MillimeterValue = "Millimeter"; + private const string MicrometerValue = "Micrometer"; + private const string NanometerValue = "Nanometer"; + private const string PicometerValue = "Picometer"; + private const string MileValue = "Mile"; + private const string YardValue = "Yard"; + private const string InchValue = "Inch"; + private const string FootValue = "Foot"; + private const string LightYearValue = "LightYear"; + private const string PointValue = "Point"; + + /// Unspecified length unit. + public static LengthUnit Unspecified { get; } = new LengthUnit(UnspecifiedValue); + /// Length unit in kilometers. + public static LengthUnit Kilometer { get; } = new LengthUnit(KilometerValue); + /// Length unit in hectometers. + public static LengthUnit Hectometer { get; } = new LengthUnit(HectometerValue); + /// Length unit in decameters. + public static LengthUnit Decameter { get; } = new LengthUnit(DecameterValue); + /// Length unit in meters. + public static LengthUnit Meter { get; } = new LengthUnit(MeterValue); + /// Length unit in decimeters. + public static LengthUnit Decimeter { get; } = new LengthUnit(DecimeterValue); + /// Length unit in centimeters. + public static LengthUnit Centimeter { get; } = new LengthUnit(CentimeterValue); + /// Length unit in millimeters. + public static LengthUnit Millimeter { get; } = new LengthUnit(MillimeterValue); + /// Length unit in micrometers. + public static LengthUnit Micrometer { get; } = new LengthUnit(MicrometerValue); + /// Length unit in nanometers. + public static LengthUnit Nanometer { get; } = new LengthUnit(NanometerValue); + /// Length unit in picometers. + public static LengthUnit Picometer { get; } = new LengthUnit(PicometerValue); + /// Length unit in miles. + public static LengthUnit Mile { get; } = new LengthUnit(MileValue); + /// Length unit in yards. + public static LengthUnit Yard { get; } = new LengthUnit(YardValue); + /// Length unit in inches. + public static LengthUnit Inch { get; } = new LengthUnit(InchValue); + /// Length unit in feet. + public static LengthUnit Foot { get; } = new LengthUnit(FootValue); + /// Length unit in light years. + public static LengthUnit LightYear { get; } = new LengthUnit(LightYearValue); + /// Length unit in points. + public static LengthUnit Point { get; } = new LengthUnit(PointValue); + /// Determines if two values are the same. + public static bool operator ==(LengthUnit left, LengthUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LengthUnit left, LengthUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LengthUnit(string value) => new LengthUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LengthUnit other && Equals(other); + /// + public bool Equals(LengthUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.Serialization.cs new file mode 100644 index 0000000000000..e495ea8fd391f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class LinkedEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LinkedEntity)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("matches"u8); + writer.WriteStartArray(); + foreach (var item in Matches) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url); + writer.WritePropertyName("dataSource"u8); + writer.WriteStringValue(DataSource); + if (Optional.IsDefined(BingId)) + { + writer.WritePropertyName("bingId"u8); + writer.WriteStringValue(BingId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + LinkedEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(LinkedEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLinkedEntity(document.RootElement, options); + } + + internal static LinkedEntity DeserializeLinkedEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IReadOnlyList matches = default; + string language = default; + string id = default; + string url = default; + string dataSource = default; + string bingId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("matches"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityLinkingMatch.DeserializeEntityLinkingMatch(item, options)); + } + matches = array; + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("url"u8)) + { + url = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataSource"u8)) + { + dataSource = property.Value.GetString(); + continue; + } + if (property.NameEquals("bingId"u8)) + { + bingId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LinkedEntity( + name, + matches, + language, + id, + url, + dataSource, + bingId, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(LinkedEntity)} does not support writing '{options.Format}' format."); + } + } + + LinkedEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeLinkedEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LinkedEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LinkedEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLinkedEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.cs new file mode 100644 index 0000000000000..d7376c5babcb1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/LinkedEntity.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// The LinkedEntity object containing the detected entity with the associated sources/links. + public partial class LinkedEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity Linking formal name. + /// List of instances this entity appears in the text. + /// Language used in the data source. + /// URL for the entity's page from the data source. + /// Data source used to extract entity linking, such as Wiki/Bing etc. + /// , , , or is null. + internal LinkedEntity(string name, IEnumerable matches, string language, string url, string dataSource) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(matches, nameof(matches)); + Argument.AssertNotNull(language, nameof(language)); + Argument.AssertNotNull(url, nameof(url)); + Argument.AssertNotNull(dataSource, nameof(dataSource)); + + Name = name; + Matches = matches.ToList(); + Language = language; + Url = url; + DataSource = dataSource; + } + + /// Initializes a new instance of . + /// Entity Linking formal name. + /// List of instances this entity appears in the text. + /// Language used in the data source. + /// Unique identifier of the recognized entity from the data source. + /// URL for the entity's page from the data source. + /// Data source used to extract entity linking, such as Wiki/Bing etc. + /// Bing Entity Search API unique identifier of the recognized entity. + /// Keeps track of any properties unknown to the library. + internal LinkedEntity(string name, IReadOnlyList matches, string language, string id, string url, string dataSource, string bingId, IDictionary serializedAdditionalRawData) + { + Name = name; + Matches = matches; + Language = language; + Id = id; + Url = url; + DataSource = dataSource; + BingId = bingId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LinkedEntity() + { + } + + /// Entity Linking formal name. + public string Name { get; } + /// List of instances this entity appears in the text. + public IReadOnlyList Matches { get; } + /// Language used in the data source. + public string Language { get; } + /// Unique identifier of the recognized entity from the data source. + public string Id { get; } + /// URL for the entity's page from the data source. + public string Url { get; } + /// Data source used to extract entity linking, such as Wiki/Bing etc. + public string DataSource { get; } + /// Bing Entity Search API unique identifier of the recognized entity. + public string BingId { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.Serialization.cs new file mode 100644 index 0000000000000..053313530153f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class ListComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListComponent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WritePropertyName("entityComponentKind"u8); + writer.WriteStringValue(EntityComponentKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ListComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ListComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeListComponent(document.RootElement, options); + } + + internal static ListComponent DeserializeListComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + EntityComponentKind entityComponentKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ListComponent(entityComponentKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ListComponent)} does not support writing '{options.Format}' format."); + } + } + + ListComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeListComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ListComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ListComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeListComponent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.cs new file mode 100644 index 0000000000000..40393ab0e8b5a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ListComponent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// This object contains information of the list component of the detected entity. + public partial class ListComponent : EntityComponentInformation + { + /// Initializes a new instance of . + internal ListComponent() + { + EntityComponentKind = EntityComponentKind.ListComponent; + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + /// The list key of an extracted entity type. + internal ListComponent(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData, string value) : base(entityComponentKind, serializedAdditionalRawData) + { + Value = value; + } + + /// The list key of an extracted entity type. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.Serialization.cs new file mode 100644 index 0000000000000..ac2b4f68f1f7a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class MatchLongestEntityPolicyType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + MatchLongestEntityPolicyType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMatchLongestEntityPolicyType(document.RootElement, options); + } + + internal static MatchLongestEntityPolicyType DeserializeMatchLongestEntityPolicyType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyKind policyKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new PolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MatchLongestEntityPolicyType(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support writing '{options.Format}' format."); + } + } + + MatchLongestEntityPolicyType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMatchLongestEntityPolicyType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MatchLongestEntityPolicyType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MatchLongestEntityPolicyType FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMatchLongestEntityPolicyType(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.cs new file mode 100644 index 0000000000000..e3740351380ea --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MatchLongestEntityPolicyType.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Match longest overlap policy. No overlapping entities as far as it is possible. 1. If there are overlapping entities, the longest one will be returned. 2. If the set of characters predicted for 2 or more entities are exactly the same, select the entity that has the higher confidence score.3. If the entity scores are identical, return all entities that are still present after applying the previous rules. 3. If there is partial overlap (as in Hello Text Analytics) follow the above steps starting from 1. + public partial class MatchLongestEntityPolicyType : EntityOverlapPolicy + { + /// Initializes a new instance of . + public MatchLongestEntityPolicyType() + { + PolicyKind = PolicyKind.MatchLongest; + } + + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal MatchLongestEntityPolicyType(PolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MetadataKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MetadataKind.cs new file mode 100644 index 0000000000000..93878fc896a36 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MetadataKind.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The entity Metadata object kind. + internal readonly partial struct MetadataKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MetadataKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DateMetadataValue = "DateMetadata"; + private const string DateTimeMetadataValue = "DateTimeMetadata"; + private const string TimeMetadataValue = "TimeMetadata"; + private const string TemporalSetMetadataValue = "TemporalSetMetadata"; + private const string NumberMetadataValue = "NumberMetadata"; + private const string OrdinalMetadataValue = "OrdinalMetadata"; + private const string SpeedMetadataValue = "SpeedMetadata"; + private const string WeightMetadataValue = "WeightMetadata"; + private const string LengthMetadataValue = "LengthMetadata"; + private const string VolumeMetadataValue = "VolumeMetadata"; + private const string AreaMetadataValue = "AreaMetadata"; + private const string AgeMetadataValue = "AgeMetadata"; + private const string InformationMetadataValue = "InformationMetadata"; + private const string TemperatureMetadataValue = "TemperatureMetadata"; + private const string CurrencyMetadataValue = "CurrencyMetadata"; + private const string NumericRangeMetadataValue = "NumericRangeMetadata"; + private const string TemporalSpanMetadataValue = "TemporalSpanMetadata"; + + /// Metadata for date-related values. + public static MetadataKind DateMetadata { get; } = new MetadataKind(DateMetadataValue); + /// Metadata for date and time-related values. + public static MetadataKind DateTimeMetadata { get; } = new MetadataKind(DateTimeMetadataValue); + /// Metadata for time-related values. + public static MetadataKind TimeMetadata { get; } = new MetadataKind(TimeMetadataValue); + /// Metadata for set of time-related values. + public static MetadataKind TemporalSetMetadata { get; } = new MetadataKind(TemporalSetMetadataValue); + /// Metadata for numeric values. + public static MetadataKind NumberMetadata { get; } = new MetadataKind(NumberMetadataValue); + /// Metadata for ordinal numbers. + public static MetadataKind OrdinalMetadata { get; } = new MetadataKind(OrdinalMetadataValue); + /// Metadata for speed-related values. + public static MetadataKind SpeedMetadata { get; } = new MetadataKind(SpeedMetadataValue); + /// Metadata for weight-related values. + public static MetadataKind WeightMetadata { get; } = new MetadataKind(WeightMetadataValue); + /// Metadata for length-related values. + public static MetadataKind LengthMetadata { get; } = new MetadataKind(LengthMetadataValue); + /// Metadata for volume-related values. + public static MetadataKind VolumeMetadata { get; } = new MetadataKind(VolumeMetadataValue); + /// Metadata for area-related values. + public static MetadataKind AreaMetadata { get; } = new MetadataKind(AreaMetadataValue); + /// Metadata for age-related values. + public static MetadataKind AgeMetadata { get; } = new MetadataKind(AgeMetadataValue); + /// Metadata for information-related values. + public static MetadataKind InformationMetadata { get; } = new MetadataKind(InformationMetadataValue); + /// Metadata for temperature-related values. + public static MetadataKind TemperatureMetadata { get; } = new MetadataKind(TemperatureMetadataValue); + /// Metadata for currency-related values. + public static MetadataKind CurrencyMetadata { get; } = new MetadataKind(CurrencyMetadataValue); + /// Metadata for numeric range values. + public static MetadataKind NumericRangeMetadata { get; } = new MetadataKind(NumericRangeMetadataValue); + /// Metadata for temporal span values. + public static MetadataKind TemporalSpanMetadata { get; } = new MetadataKind(TemporalSpanMetadataValue); + /// Determines if two values are the same. + public static bool operator ==(MetadataKind left, MetadataKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MetadataKind left, MetadataKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MetadataKind(string value) => new MetadataKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetadataKind other && Equals(other); + /// + public bool Equals(MetadataKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.Serialization.cs new file mode 100644 index 0000000000000..4e6c262d5ebef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.Serialization.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class MultiLanguageInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + if (Optional.IsDefined(Language)) + { + writer.WritePropertyName("language"u8); + writer.WriteStringValue(Language); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + MultiLanguageInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultiLanguageInput(document.RootElement, options); + } + + internal static MultiLanguageInput DeserializeMultiLanguageInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string text = default; + string language = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("language"u8)) + { + language = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MultiLanguageInput(id, text, language, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support writing '{options.Format}' format."); + } + } + + MultiLanguageInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMultiLanguageInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultiLanguageInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MultiLanguageInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMultiLanguageInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.cs new file mode 100644 index 0000000000000..d814ad5100869 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageInput.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains an input document to be analyzed by the service. + public partial class MultiLanguageInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// or is null. + public MultiLanguageInput(string id, string text) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(text, nameof(text)); + + Id = id; + Text = text; + } + + /// Initializes a new instance of . + /// A unique, non-empty document identifier. + /// The input text to process. + /// (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default. (Following only applies to 2023-04-15-preview and above) For Auto Language Detection, use \"auto\". If not set, use \"en\" for English as default. + /// Keeps track of any properties unknown to the library. + internal MultiLanguageInput(string id, string text, string language, IDictionary serializedAdditionalRawData) + { + Id = id; + Text = text; + Language = language; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MultiLanguageInput() + { + } + + /// A unique, non-empty document identifier. + public string Id { get; } + /// The input text to process. + public string Text { get; } + /// (Optional) This is the 2 letter ISO 639-1 representation of a language. For example, use \"en\" for English; \"es\" for Spanish etc. If not set, use \"en\" for English as default. (Following only applies to 2023-04-15-preview and above) For Auto Language Detection, use \"auto\". If not set, use \"en\" for English as default. + public string Language { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.Serialization.cs new file mode 100644 index 0000000000000..16720cb8575ef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class MultiLanguageTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + MultiLanguageTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMultiLanguageTextInput(document.RootElement, options); + } + + internal static MultiLanguageTextInput DeserializeMultiLanguageTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MultiLanguageInput.DeserializeMultiLanguageInput(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MultiLanguageTextInput(documents ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support writing '{options.Format}' format."); + } + } + + MultiLanguageTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMultiLanguageTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MultiLanguageTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static MultiLanguageTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeMultiLanguageTextInput(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.cs new file mode 100644 index 0000000000000..c95851d9681e9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/MultiLanguageTextInput.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Collection of input documents to be analyzed by the service. + public partial class MultiLanguageTextInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public MultiLanguageTextInput() + { + Documents = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The input documents to be analyzed. + /// Keeps track of any properties unknown to the library. + internal MultiLanguageTextInput(IList documents, IDictionary serializedAdditionalRawData) + { + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The input documents to be analyzed. + public IList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.Serialization.cs new file mode 100644 index 0000000000000..569967677f1b3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.Serialization.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class NamedEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntity)} does not support writing '{format}' format."); + } + + writer.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); + 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 + } + } + writer.WriteEndObject(); + } + + NamedEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamedEntity(document.RootElement, options); + } + + internal static NamedEntity DeserializeNamedEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + string category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamedEntity( + text, + category, + subcategory, + offset, + length, + confidenceScore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NamedEntity)} does not support writing '{options.Format}' format."); + } + } + + NamedEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNamedEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamedEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NamedEntity FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNamedEntity(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.cs new file mode 100644 index 0000000000000..69846a8d6f990 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntity.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Defines the detected entity object containing the entity category and entity text detected, etc. + public partial class NamedEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// or is null. + internal NamedEntity(string text, string category, int offset, int length, double confidenceScore) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(category, nameof(category)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// Keeps track of any properties unknown to the library. + internal NamedEntity(string text, string category, string subcategory, int offset, int length, double confidenceScore, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NamedEntity() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Entity type. + public string Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.Serialization.cs new file mode 100644 index 0000000000000..bab1a445df1a3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.Serialization.cs @@ -0,0 +1,229 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class NamedEntityWithMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support writing '{format}' format."); + } + + writer.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.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("tags"u8); + writer.WriteStartArray(); + foreach (var item in Tags) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteObjectValue(Metadata, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NamedEntityWithMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNamedEntityWithMetadata(document.RootElement, options); + } + + internal static NamedEntityWithMetadata DeserializeNamedEntityWithMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + string category = default; + string subcategory = default; + int offset = default; + int length = default; + double confidenceScore = default; + string type = default; + IReadOnlyList tags = default; + BaseMetadata metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("subcategory"u8)) + { + subcategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("confidenceScore"u8)) + { + confidenceScore = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EntityTag.DeserializeEntityTag(item, options)); + } + tags = array; + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = BaseMetadata.DeserializeBaseMetadata(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NamedEntityWithMetadata( + text, + category, + subcategory, + offset, + length, + confidenceScore, + type, + tags, + metadata, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support writing '{options.Format}' format."); + } + } + + NamedEntityWithMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNamedEntityWithMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NamedEntityWithMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static NamedEntityWithMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNamedEntityWithMetadata(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.cs new file mode 100644 index 0000000000000..ac22abc992c31 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NamedEntityWithMetadata.cs @@ -0,0 +1,131 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Entity object with tags and metadata. + public partial class NamedEntityWithMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + /// List of entity tags. Tags are to express some similarities/affinity between entities. + /// , , or is null. + internal NamedEntityWithMetadata(string text, string category, int offset, int length, double confidenceScore, string type, IEnumerable tags) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(category, nameof(category)); + Argument.AssertNotNull(type, nameof(type)); + Argument.AssertNotNull(tags, nameof(tags)); + + Text = text; + Category = category; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Type = type; + Tags = tags.ToList(); + } + + /// Initializes a new instance of . + /// Entity text as appears in the request. + /// Entity type. + /// (Optional) Entity sub type. + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + /// Confidence score between 0 and 1 of the extracted entity. + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + /// List of entity tags. Tags are to express some similarities/affinity between entities. + /// + /// The entity metadata object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal NamedEntityWithMetadata(string text, string category, string subcategory, int offset, int length, double confidenceScore, string type, IReadOnlyList tags, BaseMetadata metadata, IDictionary serializedAdditionalRawData) + { + Text = text; + Category = category; + Subcategory = subcategory; + Offset = offset; + Length = length; + ConfidenceScore = confidenceScore; + Type = type; + Tags = tags; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NamedEntityWithMetadata() + { + } + + /// Entity text as appears in the request. + public string Text { get; } + /// Entity type. + public string Category { get; } + /// (Optional) Entity sub type. + public string Subcategory { get; } + /// Start position for the entity text. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// Length for the entity text. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + /// Confidence score between 0 and 1 of the extracted entity. + public double ConfidenceScore { get; } + /// An entity type is the lowest (or finest) granularity at which the entity has been detected. The type maps to the specific metadata attributes associated with the entity detected. + public string Type { get; } + /// List of entity tags. Tags are to express some similarities/affinity between entities. + public IReadOnlyList Tags { get; } + /// + /// The entity metadata object. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , , , , and . + /// + public BaseMetadata Metadata { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberKind.cs new file mode 100644 index 0000000000000..0e005b563ed95 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberKind.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The type of the extracted number entity. + public readonly partial struct NumberKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NumberKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IntegerValue = "Integer"; + private const string DecimalValue = "Decimal"; + private const string PowerValue = "Power"; + private const string FractionValue = "Fraction"; + private const string PercentValue = "Percent"; + private const string UnspecifiedValue = "Unspecified"; + + /// Integer number. + public static NumberKind Integer { get; } = new NumberKind(IntegerValue); + /// Decimal number. + public static NumberKind Decimal { get; } = new NumberKind(DecimalValue); + /// Power number. + public static NumberKind Power { get; } = new NumberKind(PowerValue); + /// Fraction number. + public static NumberKind Fraction { get; } = new NumberKind(FractionValue); + /// Percent number. + public static NumberKind Percent { get; } = new NumberKind(PercentValue); + /// Unspecified number kind. + public static NumberKind Unspecified { get; } = new NumberKind(UnspecifiedValue); + /// Determines if two values are the same. + public static bool operator ==(NumberKind left, NumberKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NumberKind left, NumberKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator NumberKind(string value) => new NumberKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NumberKind other && Equals(other); + /// + public bool Equals(NumberKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.Serialization.cs new file mode 100644 index 0000000000000..6e7563ab8100d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class NumberMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumberMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("numberKind"u8); + writer.WriteStringValue(NumberKind.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NumberMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumberMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNumberMetadata(document.RootElement, options); + } + + internal static NumberMetadata DeserializeNumberMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + NumberKind numberKind = default; + double value = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("numberKind"u8)) + { + numberKind = new NumberKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NumberMetadata(metadataKind, serializedAdditionalRawData, numberKind, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NumberMetadata)} does not support writing '{options.Format}' format."); + } + } + + NumberMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNumberMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NumberMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new NumberMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumberMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.cs new file mode 100644 index 0000000000000..ac199d3a1f2e6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumberMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A metadata for numeric entity instances. + public partial class NumberMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// Kind of the number type. + /// A numeric representation of what the extracted text denotes. + internal NumberMetadata(NumberKind numberKind, double value) + { + MetadataKind = MetadataKind.NumberMetadata; + NumberKind = numberKind; + Value = value; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// Kind of the number type. + /// A numeric representation of what the extracted text denotes. + internal NumberMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, NumberKind numberKind, double value) : base(metadataKind, serializedAdditionalRawData) + { + NumberKind = numberKind; + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal NumberMetadata() + { + } + + /// Kind of the number type. + public NumberKind NumberKind { get; } + /// A numeric representation of what the extracted text denotes. + public double Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.Serialization.cs new file mode 100644 index 0000000000000..5b767cddefb39 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class NumericRangeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("rangeKind"u8); + writer.WriteStringValue(RangeKind.ToString()); + writer.WritePropertyName("minimum"u8); + writer.WriteNumberValue(Minimum); + writer.WritePropertyName("maximum"u8); + writer.WriteNumberValue(Maximum); + if (Optional.IsDefined(RangeInclusivity)) + { + writer.WritePropertyName("rangeInclusivity"u8); + writer.WriteStringValue(RangeInclusivity.Value.ToString()); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + NumericRangeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNumericRangeMetadata(document.RootElement, options); + } + + internal static NumericRangeMetadata DeserializeNumericRangeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RangeKind rangeKind = default; + double minimum = default; + double maximum = default; + RangeInclusivity? rangeInclusivity = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rangeKind"u8)) + { + rangeKind = new RangeKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("minimum"u8)) + { + minimum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("maximum"u8)) + { + maximum = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("rangeInclusivity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rangeInclusivity = new RangeInclusivity(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NumericRangeMetadata( + metadataKind, + serializedAdditionalRawData, + rangeKind, + minimum, + maximum, + rangeInclusivity); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support writing '{options.Format}' format."); + } + } + + NumericRangeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeNumericRangeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NumericRangeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new NumericRangeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeNumericRangeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.cs new file mode 100644 index 0000000000000..2e486730ff9be --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/NumericRangeMetadata.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// represents the Metadata of numeric intervals. + public partial class NumericRangeMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// Kind of numeric ranges supported - like Number, Speed, etc. + /// The beginning value of the interval. + /// The ending value of the interval. + internal NumericRangeMetadata(RangeKind rangeKind, double minimum, double maximum) + { + MetadataKind = MetadataKind.NumericRangeMetadata; + RangeKind = rangeKind; + Minimum = minimum; + Maximum = maximum; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// Kind of numeric ranges supported - like Number, Speed, etc. + /// The beginning value of the interval. + /// The ending value of the interval. + /// The inclusiveness of this range. + internal NumericRangeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, RangeKind rangeKind, double minimum, double maximum, RangeInclusivity? rangeInclusivity) : base(metadataKind, serializedAdditionalRawData) + { + RangeKind = rangeKind; + Minimum = minimum; + Maximum = maximum; + RangeInclusivity = rangeInclusivity; + } + + /// Initializes a new instance of for deserialization. + internal NumericRangeMetadata() + { + } + + /// Kind of numeric ranges supported - like Number, Speed, etc. + public RangeKind RangeKind { get; } + /// The beginning value of the interval. + public double Minimum { get; } + /// The ending value of the interval. + public double Maximum { get; } + /// The inclusiveness of this range. + public RangeInclusivity? RangeInclusivity { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.Serialization.cs new file mode 100644 index 0000000000000..c39224c60621c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class OrdinalMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("offset"u8); + writer.WriteStringValue(Offset); + writer.WritePropertyName("relativeTo"u8); + writer.WriteStringValue(RelativeTo.ToString()); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + OrdinalMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOrdinalMetadata(document.RootElement, options); + } + + internal static OrdinalMetadata DeserializeOrdinalMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string offset = default; + RelativeTo relativeTo = default; + string value = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetString(); + continue; + } + if (property.NameEquals("relativeTo"u8)) + { + relativeTo = new RelativeTo(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OrdinalMetadata(metadataKind, serializedAdditionalRawData, offset, relativeTo, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support writing '{options.Format}' format."); + } + } + + OrdinalMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOrdinalMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OrdinalMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new OrdinalMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOrdinalMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.cs new file mode 100644 index 0000000000000..babb71773d582 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/OrdinalMetadata.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A metadata for numeric entity instances. + public partial class OrdinalMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + /// or is null. + internal OrdinalMetadata(string offset, RelativeTo relativeTo, string value) + { + Argument.AssertNotNull(offset, nameof(offset)); + Argument.AssertNotNull(value, nameof(value)); + + MetadataKind = MetadataKind.OrdinalMetadata; + Offset = offset; + RelativeTo = relativeTo; + Value = value; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + /// The reference point that the ordinal number denotes. + /// A simple arithmetic expression that the ordinal denotes. + internal OrdinalMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, string offset, RelativeTo relativeTo, string value) : base(metadataKind, serializedAdditionalRawData) + { + Offset = offset; + RelativeTo = relativeTo; + Value = value; + } + + /// Initializes a new instance of for deserialization. + internal OrdinalMetadata() + { + } + + /// The offset with respect to the reference (e.g., offset = -1 indicates the second to last). + public string Offset { get; } + /// The reference point that the ordinal number denotes. + public RelativeTo RelativeTo { get; } + /// A simple arithmetic expression that the ordinal denotes. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.Serialization.cs new file mode 100644 index 0000000000000..eae32ee9616e4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.Serialization.cs @@ -0,0 +1,256 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class PiiActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + 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); + writer.WriteStringValue(Domain.Value.ToString()); + } + if (Optional.IsCollectionDefined(PiiCategories)) + { + writer.WritePropertyName("piiCategories"u8); + writer.WriteStartArray(); + foreach (var item in PiiCategories) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (Optional.IsCollectionDefined(ExcludePiiCategories)) + { + writer.WritePropertyName("excludePiiCategories"u8); + writer.WriteStartArray(); + foreach (var item in ExcludePiiCategories) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RedactionCharacter)) + { + writer.WritePropertyName("redactionCharacter"u8); + writer.WriteStringValue(RedactionCharacter.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PiiActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiActionContent(document.RootElement, options); + } + + internal static PiiActionContent DeserializePiiActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + PiiDomain? domain = default; + IList piiCategories = default; + StringIndexType? stringIndexType = default; + IList excludePiiCategories = default; + RedactionCharacter? redactionCharacter = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domain = new PiiDomain(property.Value.GetString()); + continue; + } + if (property.NameEquals("piiCategories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new PiiCategory(item.GetString())); + } + piiCategories = array; + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (property.NameEquals("excludePiiCategories"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new PiiCategoriesExclude(item.GetString())); + } + excludePiiCategories = array; + continue; + } + if (property.NameEquals("redactionCharacter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redactionCharacter = new RedactionCharacter(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiActionContent( + loggingOptOut, + modelVersion, + domain, + piiCategories ?? new ChangeTrackingList(), + stringIndexType, + excludePiiCategories ?? new ChangeTrackingList(), + redactionCharacter, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiActionContent)} does not support writing '{options.Format}' format."); + } + } + + PiiActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PiiActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.cs new file mode 100644 index 0000000000000..fe543c359ad75 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiActionContent.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a PII Entities Recognition task. + public partial class PiiActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PiiActionContent() + { + PiiCategories = new ChangeTrackingList(); + ExcludePiiCategories = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Domain for PII task. + /// Enumeration of PII categories to be returned in the response. + /// StringIndexType to be used for analysis. + /// Enumeration of PII categories to be excluded in the response. + /// Character to be used for redaction. Default in '*'. + /// Keeps track of any properties unknown to the library. + internal PiiActionContent(bool? loggingOptOut, string modelVersion, PiiDomain? domain, IList piiCategories, StringIndexType? stringIndexType, IList excludePiiCategories, RedactionCharacter? redactionCharacter, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + Domain = domain; + PiiCategories = piiCategories; + StringIndexType = stringIndexType; + ExcludePiiCategories = excludePiiCategories; + RedactionCharacter = redactionCharacter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Domain for PII task. + public PiiDomain? Domain { get; set; } + /// Enumeration of PII categories to be returned in the response. + public IList PiiCategories { get; } + /// StringIndexType to be used for analysis. + public StringIndexType? StringIndexType { get; set; } + /// Enumeration of PII categories to be excluded in the response. + public IList ExcludePiiCategories { get; } + /// Character to be used for redaction. Default in '*'. + public RedactionCharacter? RedactionCharacter { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategoriesExclude.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategoriesExclude.cs new file mode 100644 index 0000000000000..aadd065dbf6ca --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategoriesExclude.cs @@ -0,0 +1,558 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// (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 string to a . + public static implicit operator PiiCategoriesExclude(string value) => new PiiCategoriesExclude(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PiiCategoriesExclude other && Equals(other); + /// + public bool Equals(PiiCategoriesExclude other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategory.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategory.cs new file mode 100644 index 0000000000000..744f17f2f491b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiCategory.cs @@ -0,0 +1,564 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// (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 string to a . + public static implicit operator PiiCategory(string value) => new PiiCategory(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PiiCategory other && Equals(other); + /// + public bool Equals(PiiCategory other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiDomain.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiDomain.cs new file mode 100644 index 0000000000000..27111a7e01fa8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiDomain.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// 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 string to a . + public static implicit operator PiiDomain(string value) => new PiiDomain(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PiiDomain other && Equals(other); + /// + public bool Equals(PiiDomain other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.Serialization.cs new file mode 100644 index 0000000000000..4809936c7b313 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class PiiEntityRecognitionOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PiiEntityRecognitionOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiEntityRecognitionOperationResult(document.RootElement, options); + } + + internal static PiiEntityRecognitionOperationResult DeserializePiiEntityRecognitionOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = PiiResult.DeserializePiiResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiEntityRecognitionOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support writing '{options.Format}' format."); + } + } + + PiiEntityRecognitionOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiEntityRecognitionOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiEntityRecognitionOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PiiEntityRecognitionOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiEntityRecognitionOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.cs new file mode 100644 index 0000000000000..497f68355267a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiEntityRecognitionOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the PII LRO results. + public partial class PiiEntityRecognitionOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// The list of pii results. + /// is null. + internal PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, PiiResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.PiiEntityRecognitionOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// The list of pii results. + internal PiiEntityRecognitionOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, PiiResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal PiiEntityRecognitionOperationResult() + { + } + + /// The list of pii results. + public PiiResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.Serialization.cs new file mode 100644 index 0000000000000..0746ae9aa1165 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class PiiOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + PiiOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiOperationAction(document.RootElement, options); + } + + internal static PiiOperationAction DeserializePiiOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PiiActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = PiiActionContent.DeserializePiiActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support writing '{options.Format}' format."); + } + } + + PiiOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PiiOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.cs new file mode 100644 index 0000000000000..3c096c1fd4ab1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text PIIEntityRecognition LRO task. + public partial class PiiOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public PiiOperationAction() + { + Kind = AnalyzeTextOperationActionKind.PiiEntityRecognition; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Pii task parameters. + internal PiiOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, PiiActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Pii task parameters. + public PiiActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.Serialization.cs new file mode 100644 index 0000000000000..bae7fa51f7fef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class PiiResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + PiiResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiResult(document.RootElement, options); + } + + internal static PiiResult DeserializePiiResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(PiiResultWithDetectedLanguage.DeserializePiiResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiResult)} does not support writing '{options.Format}' format."); + } + } + + PiiResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePiiResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PiiResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.cs new file mode 100644 index 0000000000000..3b75743de1d3e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the PiiResult. + public partial class PiiResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// Response by document. + /// , or is null. + internal PiiResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// Response by document. + /// Keeps track of any properties unknown to the library. + internal PiiResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PiiResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// Response by document. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..f5fbdd4dc3999 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class PiiResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PiiResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("redactedText"u8); + writer.WriteStringValue(RedactedText); + writer.WritePropertyName("entities"u8); + writer.WriteStartArray(); + foreach (var item in Entities) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PiiResultWithDetectedLanguage 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(PiiResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePiiResultWithDetectedLanguage(document.RootElement, options); + } + + internal static PiiResultWithDetectedLanguage DeserializePiiResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + string redactedText = default; + IReadOnlyList entities = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("redactedText"u8)) + { + redactedText = property.Value.GetString(); + continue; + } + if (property.NameEquals("entities"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(NamedEntity.DeserializeNamedEntity(item, options)); + } + entities = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PiiResultWithDetectedLanguage( + id, + warnings, + statistics, + redactedText, + entities, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PiiResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + PiiResultWithDetectedLanguage 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 DeserializePiiResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PiiResultWithDetectedLanguage)} 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 PiiResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePiiResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..28096469197e2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PiiResultWithDetectedLanguage.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the PII results with detected language. + public partial class PiiResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Returns redacted text. + /// Recognized entities in the document. + /// , , or is null. + internal PiiResultWithDetectedLanguage(string id, IEnumerable warnings, string redactedText, IEnumerable entities) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(redactedText, nameof(redactedText)); + Argument.AssertNotNull(entities, nameof(entities)); + + Id = id; + Warnings = warnings.ToList(); + RedactedText = redactedText; + Entities = entities.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Returns redacted text. + /// Recognized entities in the document. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal PiiResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, string redactedText, IReadOnlyList entities, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + RedactedText = redactedText; + Entities = entities; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PiiResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Returns redacted text. + public string RedactedText { get; } + /// Recognized entities in the document. + public IReadOnlyList Entities { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PolicyKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PolicyKind.cs new file mode 100644 index 0000000000000..994c4db51ce6a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PolicyKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Kinds of overlap policies supported. + internal readonly partial struct PolicyKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MatchLongestValue = "matchLongest"; + private const string AllowOverlapValue = "allowOverlap"; + + /// Represents MatchLongestEntityPolicyType. + public static PolicyKind MatchLongest { get; } = new PolicyKind(MatchLongestValue); + /// Represents AllowOverlapEntityPolicyType. + public static PolicyKind AllowOverlap { get; } = new PolicyKind(AllowOverlapValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyKind left, PolicyKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyKind left, PolicyKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PolicyKind(string value) => new PolicyKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyKind other && Equals(other); + /// + public bool Equals(PolicyKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.Serialization.cs new file mode 100644 index 0000000000000..85d8b707c523c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class PrebuiltComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + writer.WritePropertyName("entityComponentKind"u8); + writer.WriteStringValue(EntityComponentKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PrebuiltComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePrebuiltComponent(document.RootElement, options); + } + + internal static PrebuiltComponent DeserializePrebuiltComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + EntityComponentKind entityComponentKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PrebuiltComponent(entityComponentKind, serializedAdditionalRawData, value); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support writing '{options.Format}' format."); + } + } + + PrebuiltComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePrebuiltComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PrebuiltComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PrebuiltComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePrebuiltComponent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.cs new file mode 100644 index 0000000000000..0cbab4665ec52 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/PrebuiltComponent.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// This object contains information of the prebuilt component of the detected entity. + public partial class PrebuiltComponent : EntityComponentInformation + { + /// Initializes a new instance of . + internal PrebuiltComponent() + { + EntityComponentKind = EntityComponentKind.PrebuiltComponent; + } + + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + /// The prebuilt component of an extracted entity type. + internal PrebuiltComponent(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData, string value) : base(entityComponentKind, serializedAdditionalRawData) + { + Value = value; + } + + /// The prebuilt component of an extracted entity type. + public string Value { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeInclusivity.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeInclusivity.cs new file mode 100644 index 0000000000000..e794321b5a570 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeInclusivity.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The range inclusiveness of this property property. + public readonly partial struct RangeInclusivity : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RangeInclusivity(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneInclusiveValue = "NoneInclusive"; + private const string LeftInclusiveValue = "LeftInclusive"; + private const string RightInclusiveValue = "RightInclusive"; + private const string LeftRightInclusiveValue = "LeftRightInclusive"; + + /// No inclusivity. + public static RangeInclusivity NoneInclusive { get; } = new RangeInclusivity(NoneInclusiveValue); + /// Left side inclusive. + public static RangeInclusivity LeftInclusive { get; } = new RangeInclusivity(LeftInclusiveValue); + /// Right side inclusive. + public static RangeInclusivity RightInclusive { get; } = new RangeInclusivity(RightInclusiveValue); + /// Both sides inclusive. + public static RangeInclusivity LeftRightInclusive { get; } = new RangeInclusivity(LeftRightInclusiveValue); + /// Determines if two values are the same. + public static bool operator ==(RangeInclusivity left, RangeInclusivity right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RangeInclusivity left, RangeInclusivity right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RangeInclusivity(string value) => new RangeInclusivity(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RangeInclusivity other && Equals(other); + /// + public bool Equals(RangeInclusivity other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeKind.cs new file mode 100644 index 0000000000000..b4723ee3bf944 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RangeKind.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The kind of the number range entity. + public readonly partial struct RangeKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RangeKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NumberValue = "Number"; + private const string SpeedValue = "Speed"; + private const string WeightValue = "Weight"; + private const string LengthValue = "Length"; + private const string VolumeValue = "Volume"; + private const string AreaValue = "Area"; + private const string AgeValue = "Age"; + private const string InformationValue = "Information"; + private const string TemperatureValue = "Temperature"; + private const string CurrencyValue = "Currency"; + + /// Number range. + public static RangeKind Number { get; } = new RangeKind(NumberValue); + /// Speed range. + public static RangeKind Speed { get; } = new RangeKind(SpeedValue); + /// Weight range. + public static RangeKind Weight { get; } = new RangeKind(WeightValue); + /// Length range. + public static RangeKind Length { get; } = new RangeKind(LengthValue); + /// Volume range. + public static RangeKind Volume { get; } = new RangeKind(VolumeValue); + /// Area range. + public static RangeKind Area { get; } = new RangeKind(AreaValue); + /// Age range. + public static RangeKind Age { get; } = new RangeKind(AgeValue); + /// Information range. + public static RangeKind Information { get; } = new RangeKind(InformationValue); + /// Temperature range. + public static RangeKind Temperature { get; } = new RangeKind(TemperatureValue); + /// Currency range. + public static RangeKind Currency { get; } = new RangeKind(CurrencyValue); + /// Determines if two values are the same. + public static bool operator ==(RangeKind left, RangeKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RangeKind left, RangeKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RangeKind(string value) => new RangeKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RangeKind other && Equals(other); + /// + public bool Equals(RangeKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RedactionCharacter.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RedactionCharacter.cs new file mode 100644 index 0000000000000..daf44a03c1892 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RedactionCharacter.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// 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 string to a . + public static implicit operator RedactionCharacter(string value) => new RedactionCharacter(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedactionCharacter other && Equals(other); + /// + public bool Equals(RedactionCharacter other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelationType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelationType.cs new file mode 100644 index 0000000000000..4167b4c806bab --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelationType.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Type of relation. Examples include: `DosageOfMedication` or 'FrequencyOfMedication', etc. + public readonly partial struct RelationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RelationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AbbreviationValue = "Abbreviation"; + private const string DirectionOfBodyStructureValue = "DirectionOfBodyStructure"; + private const string DirectionOfConditionValue = "DirectionOfCondition"; + private const string DirectionOfExaminationValue = "DirectionOfExamination"; + private const string DirectionOfTreatmentValue = "DirectionOfTreatment"; + private const string DosageOfMedicationValue = "DosageOfMedication"; + private const string FormOfMedicationValue = "FormOfMedication"; + private const string FrequencyOfMedicationValue = "FrequencyOfMedication"; + private const string FrequencyOfTreatmentValue = "FrequencyOfTreatment"; + private const string QualifierOfConditionValue = "QualifierOfCondition"; + private const string RelationOfExaminationValue = "RelationOfExamination"; + private const string RouteOfMedicationValue = "RouteOfMedication"; + private const string TimeOfConditionValue = "TimeOfCondition"; + private const string TimeOfEventValue = "TimeOfEvent"; + private const string TimeOfExaminationValue = "TimeOfExamination"; + private const string TimeOfMedicationValue = "TimeOfMedication"; + private const string TimeOfTreatmentValue = "TimeOfTreatment"; + private const string UnitOfConditionValue = "UnitOfCondition"; + private const string UnitOfExaminationValue = "UnitOfExamination"; + private const string ValueOfConditionValue = "ValueOfCondition"; + private const string ValueOfExaminationValue = "ValueOfExamination"; + private const string BodySiteOfConditionValue = "BodySiteOfCondition"; + private const string BodySiteOfTreatmentValue = "BodySiteOfTreatment"; + private const string CourseOfConditionValue = "CourseOfCondition"; + private const string CourseOfExaminationValue = "CourseOfExamination"; + private const string CourseOfMedicationValue = "CourseOfMedication"; + private const string CourseOfTreatmentValue = "CourseOfTreatment"; + private const string ExaminationFindsConditionValue = "ExaminationFindsCondition"; + private const string ExpressionOfGeneValue = "ExpressionOfGene"; + private const string ExpressionOfVariantValue = "ExpressionOfVariant"; + private const string FrequencyOfConditionValue = "FrequencyOfCondition"; + private const string MutationTypeOfGeneValue = "MutationTypeOfGene"; + private const string MutationTypeOfVariantValue = "MutationTypeOfVariant"; + private const string ScaleOfConditionValue = "ScaleOfCondition"; + private const string VariantOfGeneValue = "VariantOfGene"; + + /// Abbreviation. + public static RelationType Abbreviation { get; } = new RelationType(AbbreviationValue); + /// Direction of body structure. + public static RelationType DirectionOfBodyStructure { get; } = new RelationType(DirectionOfBodyStructureValue); + /// Direction of condition. + public static RelationType DirectionOfCondition { get; } = new RelationType(DirectionOfConditionValue); + /// Direction of examination. + public static RelationType DirectionOfExamination { get; } = new RelationType(DirectionOfExaminationValue); + /// Direction of treatment. + public static RelationType DirectionOfTreatment { get; } = new RelationType(DirectionOfTreatmentValue); + /// Dosage of medication. + public static RelationType DosageOfMedication { get; } = new RelationType(DosageOfMedicationValue); + /// Form of medication. + public static RelationType FormOfMedication { get; } = new RelationType(FormOfMedicationValue); + /// Frequency of medication. + public static RelationType FrequencyOfMedication { get; } = new RelationType(FrequencyOfMedicationValue); + /// Frequency of treatment. + public static RelationType FrequencyOfTreatment { get; } = new RelationType(FrequencyOfTreatmentValue); + /// Qualifier of condition. + public static RelationType QualifierOfCondition { get; } = new RelationType(QualifierOfConditionValue); + /// Relation of examination. + public static RelationType RelationOfExamination { get; } = new RelationType(RelationOfExaminationValue); + /// Route of medication. + public static RelationType RouteOfMedication { get; } = new RelationType(RouteOfMedicationValue); + /// Time of condition. + public static RelationType TimeOfCondition { get; } = new RelationType(TimeOfConditionValue); + /// Time of event. + public static RelationType TimeOfEvent { get; } = new RelationType(TimeOfEventValue); + /// Time of examination. + public static RelationType TimeOfExamination { get; } = new RelationType(TimeOfExaminationValue); + /// Time of medication. + public static RelationType TimeOfMedication { get; } = new RelationType(TimeOfMedicationValue); + /// Time of treatment. + public static RelationType TimeOfTreatment { get; } = new RelationType(TimeOfTreatmentValue); + /// Unit of condition. + public static RelationType UnitOfCondition { get; } = new RelationType(UnitOfConditionValue); + /// Unit of examination. + public static RelationType UnitOfExamination { get; } = new RelationType(UnitOfExaminationValue); + /// Value of condition. + public static RelationType ValueOfCondition { get; } = new RelationType(ValueOfConditionValue); + /// Value of examination. + public static RelationType ValueOfExamination { get; } = new RelationType(ValueOfExaminationValue); + /// Body site of condition. + public static RelationType BodySiteOfCondition { get; } = new RelationType(BodySiteOfConditionValue); + /// Body site of treatment. + public static RelationType BodySiteOfTreatment { get; } = new RelationType(BodySiteOfTreatmentValue); + /// Course of condition. + public static RelationType CourseOfCondition { get; } = new RelationType(CourseOfConditionValue); + /// Course of examination. + public static RelationType CourseOfExamination { get; } = new RelationType(CourseOfExaminationValue); + /// Course of medication. + public static RelationType CourseOfMedication { get; } = new RelationType(CourseOfMedicationValue); + /// Course of treatment. + public static RelationType CourseOfTreatment { get; } = new RelationType(CourseOfTreatmentValue); + /// Examination finds condition. + public static RelationType ExaminationFindsCondition { get; } = new RelationType(ExaminationFindsConditionValue); + /// Expression of gene. + public static RelationType ExpressionOfGene { get; } = new RelationType(ExpressionOfGeneValue); + /// Expression of variant. + public static RelationType ExpressionOfVariant { get; } = new RelationType(ExpressionOfVariantValue); + /// Frequency of condition. + public static RelationType FrequencyOfCondition { get; } = new RelationType(FrequencyOfConditionValue); + /// Mutation type of gene. + public static RelationType MutationTypeOfGene { get; } = new RelationType(MutationTypeOfGeneValue); + /// Mutation type of variant. + public static RelationType MutationTypeOfVariant { get; } = new RelationType(MutationTypeOfVariantValue); + /// Scale of condition. + public static RelationType ScaleOfCondition { get; } = new RelationType(ScaleOfConditionValue); + /// Variant of gene. + public static RelationType VariantOfGene { get; } = new RelationType(VariantOfGeneValue); + /// Determines if two values are the same. + public static bool operator ==(RelationType left, RelationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RelationType left, RelationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RelationType(string value) => new RelationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RelationType other && Equals(other); + /// + public bool Equals(RelationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelativeTo.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelativeTo.cs new file mode 100644 index 0000000000000..3dbf210bff164 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RelativeTo.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The reference point that the ordinal number denotes. + public readonly partial struct RelativeTo : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RelativeTo(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CurrentValue = "Current"; + private const string EndValue = "End"; + private const string StartValue = "Start"; + + /// Current state or position. + public static RelativeTo Current { get; } = new RelativeTo(CurrentValue); + /// End state or position. + public static RelativeTo End { get; } = new RelativeTo(EndValue); + /// Start state or position. + public static RelativeTo Start { get; } = new RelativeTo(StartValue); + /// Determines if two values are the same. + public static bool operator ==(RelativeTo left, RelativeTo right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RelativeTo left, RelativeTo right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RelativeTo(string value) => new RelativeTo(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RelativeTo other && Equals(other); + /// + public bool Equals(RelativeTo other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.Serialization.cs new file mode 100644 index 0000000000000..70238c5d80a87 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class RequestStatistics : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(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.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + RequestStatistics IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestStatistics)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequestStatistics(document.RootElement, options); + } + + internal static RequestStatistics DeserializeRequestStatistics(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int documentsCount = default; + int validDocumentsCount = default; + int erroneousDocumentsCount = default; + long transactionsCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("documentsCount"u8)) + { + documentsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("validDocumentsCount"u8)) + { + validDocumentsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("erroneousDocumentsCount"u8)) + { + erroneousDocumentsCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("transactionsCount"u8)) + { + transactionsCount = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequestStatistics(documentsCount, validDocumentsCount, erroneousDocumentsCount, transactionsCount, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequestStatistics)} does not support writing '{options.Format}' format."); + } + } + + RequestStatistics IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequestStatistics(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequestStatistics)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RequestStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRequestStatistics(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.cs new file mode 100644 index 0000000000000..cfa8b6b7c8f39 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/RequestStatistics.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// if showStats=true was specified in the request this field will contain information about the request payload. + public partial class RequestStatistics + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of documents submitted in the request. + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + /// Number of transactions for the request. + internal RequestStatistics(int documentsCount, int validDocumentsCount, int erroneousDocumentsCount, long transactionsCount) + { + DocumentsCount = documentsCount; + ValidDocumentsCount = validDocumentsCount; + ErroneousDocumentsCount = erroneousDocumentsCount; + TransactionsCount = transactionsCount; + } + + /// Initializes a new instance of . + /// Number of documents submitted in the request. + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + /// Number of transactions for the request. + /// Keeps track of any properties unknown to the library. + internal RequestStatistics(int documentsCount, int validDocumentsCount, int erroneousDocumentsCount, long transactionsCount, IDictionary serializedAdditionalRawData) + { + DocumentsCount = documentsCount; + ValidDocumentsCount = validDocumentsCount; + ErroneousDocumentsCount = erroneousDocumentsCount; + TransactionsCount = transactionsCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequestStatistics() + { + } + + /// Number of documents submitted in the request. + public int DocumentsCount { get; } + /// Number of valid documents. This excludes empty, over-size limit or non-supported languages documents. + public int ValidDocumentsCount { get; } + /// Number of invalid documents. This includes empty, over-size limit or non-supported languages documents. + public int ErroneousDocumentsCount { get; } + /// Number of transactions for the request. + public long TransactionsCount { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptCode.cs new file mode 100644 index 0000000000000..70642cad83e7b --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptCode.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Identifies the script of the input document. Maps to the ISO 15924 standard script code. + public readonly partial struct ScriptCode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptCode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ArabValue = "Arab"; + private const string ArmnValue = "Armn"; + private const string BengValue = "Beng"; + private const string CansValue = "Cans"; + private const string CyrlValue = "Cyrl"; + private const string DevaValue = "Deva"; + private const string EthiValue = "Ethi"; + private const string GeorValue = "Geor"; + private const string GrekValue = "Grek"; + private const string GujrValue = "Gujr"; + private const string GuruValue = "Guru"; + private const string HangValue = "Hang"; + private const string HansValue = "Hans"; + private const string HantValue = "Hant"; + private const string HebrValue = "Hebr"; + private const string JpanValue = "Jpan"; + private const string KhmrValue = "Khmr"; + private const string KndaValue = "Knda"; + private const string LaooValue = "Laoo"; + private const string LatnValue = "Latn"; + private const string MlymValue = "Mlym"; + private const string MymrValue = "Mymr"; + private const string OryaValue = "Orya"; + private const string SinhValue = "Sinh"; + private const string TamlValue = "Taml"; + private const string TeluValue = "Telu"; + private const string ThaaValue = "Thaa"; + private const string ThaiValue = "Thai"; + private const string TibtValue = "Tibt"; + + /// Script code for the Arabic script. + public static ScriptCode Arab { get; } = new ScriptCode(ArabValue); + /// Script code for the Armenian script. + public static ScriptCode Armn { get; } = new ScriptCode(ArmnValue); + /// Script code for the Bangla script. + public static ScriptCode Beng { get; } = new ScriptCode(BengValue); + /// Script code for the UnifiedCanadianAboriginalSyllabics script. + public static ScriptCode Cans { get; } = new ScriptCode(CansValue); + /// Script code for the Cyrillic script. + public static ScriptCode Cyrl { get; } = new ScriptCode(CyrlValue); + /// Script code for the Devanagari script. + public static ScriptCode Deva { get; } = new ScriptCode(DevaValue); + /// Script code for the Ethiopic script. + public static ScriptCode Ethi { get; } = new ScriptCode(EthiValue); + /// Script code for the Georgian script. + public static ScriptCode Geor { get; } = new ScriptCode(GeorValue); + /// Script code for the Greek script. + public static ScriptCode Grek { get; } = new ScriptCode(GrekValue); + /// Script code for the Gujarati script. + public static ScriptCode Gujr { get; } = new ScriptCode(GujrValue); + /// Script code for the Gurmukhi script. + public static ScriptCode Guru { get; } = new ScriptCode(GuruValue); + /// Script code for the Hangul script. + public static ScriptCode Hang { get; } = new ScriptCode(HangValue); + /// Script code for the HanSimplified script. + public static ScriptCode Hans { get; } = new ScriptCode(HansValue); + /// Script code for the HanTraditional script. + public static ScriptCode Hant { get; } = new ScriptCode(HantValue); + /// Script code for the Hebrew script. + public static ScriptCode Hebr { get; } = new ScriptCode(HebrValue); + /// Script code for the Japanese script. + public static ScriptCode Jpan { get; } = new ScriptCode(JpanValue); + /// Script code for the Khmer script. + public static ScriptCode Khmr { get; } = new ScriptCode(KhmrValue); + /// Script code for the Kannada script. + public static ScriptCode Knda { get; } = new ScriptCode(KndaValue); + /// Script code for the Lao script. + public static ScriptCode Laoo { get; } = new ScriptCode(LaooValue); + /// Script code for the Latin script. + public static ScriptCode Latn { get; } = new ScriptCode(LatnValue); + /// Script code for the Malayalam script. + public static ScriptCode Mlym { get; } = new ScriptCode(MlymValue); + /// Script code for the Myanmar script. + public static ScriptCode Mymr { get; } = new ScriptCode(MymrValue); + /// Script code for the Odia script. + public static ScriptCode Orya { get; } = new ScriptCode(OryaValue); + /// Script code for the Sinhala script. + public static ScriptCode Sinh { get; } = new ScriptCode(SinhValue); + /// Script code for the Tamil script. + public static ScriptCode Taml { get; } = new ScriptCode(TamlValue); + /// Script code for the Telugu script. + public static ScriptCode Telu { get; } = new ScriptCode(TeluValue); + /// Script code for the Thaana script. + public static ScriptCode Thaa { get; } = new ScriptCode(ThaaValue); + /// Script code for the Thai script. + public static ScriptCode Thai { get; } = new ScriptCode(ThaiValue); + /// Script code for the Tibetan script. + public static ScriptCode Tibt { get; } = new ScriptCode(TibtValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptCode left, ScriptCode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptCode left, ScriptCode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptCode(string value) => new ScriptCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptCode other && Equals(other); + /// + public bool Equals(ScriptCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptKind.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptKind.cs new file mode 100644 index 0000000000000..80c35d4dba052 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/ScriptKind.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// Identifies the script of the input document. Maps to the ISO 15924 standard formal name. + public readonly partial struct ScriptKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ScriptKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ArabicValue = "Arabic"; + private const string ArmenianValue = "Armenian"; + private const string BanglaValue = "Bangla"; + private const string UnifiedCanadianAboriginalSyllabicsValue = "UnifiedCanadianAboriginalSyllabics"; + private const string CyrillicValue = "Cyrillic"; + private const string DevanagariValue = "Devanagari"; + private const string EthiopicValue = "Ethiopic"; + private const string GeorgianValue = "Georgian"; + private const string GreekValue = "Greek"; + private const string GujaratiValue = "Gujarati"; + private const string GurmukhiValue = "Gurmukhi"; + private const string HangulValue = "Hangul"; + private const string HanSimplifiedValue = "HanSimplified"; + private const string HanTraditionalValue = "HanTraditional"; + private const string HebrewValue = "Hebrew"; + private const string JapaneseValue = "Japanese"; + private const string KhmerValue = "Khmer"; + private const string KannadaValue = "Kannada"; + private const string LaoValue = "Lao"; + private const string LatinValue = "Latin"; + private const string MalayalamValue = "Malayalam"; + private const string MyanmarValue = "Myanmar"; + private const string OdiaValue = "Odia"; + private const string SinhalaValue = "Sinhala"; + private const string TamilValue = "Tamil"; + private const string TeluguValue = "Telugu"; + private const string ThaanaValue = "Thaana"; + private const string ThaiValue = "Thai"; + private const string TibetanValue = "Tibetan"; + + /// Script name for the Arabic script. + public static ScriptKind Arabic { get; } = new ScriptKind(ArabicValue); + /// Script name for the Armenian script. + public static ScriptKind Armenian { get; } = new ScriptKind(ArmenianValue); + /// Script name for the Bangla script. + public static ScriptKind Bangla { get; } = new ScriptKind(BanglaValue); + /// Script name for the UnifiedCanadianAboriginalSyllabics script. + public static ScriptKind UnifiedCanadianAboriginalSyllabics { get; } = new ScriptKind(UnifiedCanadianAboriginalSyllabicsValue); + /// Script name for the Cyrillic script. + public static ScriptKind Cyrillic { get; } = new ScriptKind(CyrillicValue); + /// Script name for the Devanagari script. + public static ScriptKind Devanagari { get; } = new ScriptKind(DevanagariValue); + /// Script name for the Ethiopic script. + public static ScriptKind Ethiopic { get; } = new ScriptKind(EthiopicValue); + /// Script name for the Georgian script. + public static ScriptKind Georgian { get; } = new ScriptKind(GeorgianValue); + /// Script name for the Greek script. + public static ScriptKind Greek { get; } = new ScriptKind(GreekValue); + /// Script name for the Gujarati script. + public static ScriptKind Gujarati { get; } = new ScriptKind(GujaratiValue); + /// Script name for the Gurmukhi script. + public static ScriptKind Gurmukhi { get; } = new ScriptKind(GurmukhiValue); + /// Script name for the Hangul script. + public static ScriptKind Hangul { get; } = new ScriptKind(HangulValue); + /// Script name for the HanSimplified script. + public static ScriptKind HanSimplified { get; } = new ScriptKind(HanSimplifiedValue); + /// Script name for the HanTraditional script. + public static ScriptKind HanTraditional { get; } = new ScriptKind(HanTraditionalValue); + /// Script name for the Hebrew script. + public static ScriptKind Hebrew { get; } = new ScriptKind(HebrewValue); + /// Script name for the Japanese script. + public static ScriptKind Japanese { get; } = new ScriptKind(JapaneseValue); + /// Script name for the Khmer script. + public static ScriptKind Khmer { get; } = new ScriptKind(KhmerValue); + /// Script name for the Kannada script. + public static ScriptKind Kannada { get; } = new ScriptKind(KannadaValue); + /// Script name for the Lao script. + public static ScriptKind Lao { get; } = new ScriptKind(LaoValue); + /// Script name for the Latin script. + public static ScriptKind Latin { get; } = new ScriptKind(LatinValue); + /// Script name for the Malayalam script. + public static ScriptKind Malayalam { get; } = new ScriptKind(MalayalamValue); + /// Script name for the Myanmar script. + public static ScriptKind Myanmar { get; } = new ScriptKind(MyanmarValue); + /// Script name for the Odia script. + public static ScriptKind Odia { get; } = new ScriptKind(OdiaValue); + /// Script name for the Sinhala script. + public static ScriptKind Sinhala { get; } = new ScriptKind(SinhalaValue); + /// Script name for the Tamil script. + public static ScriptKind Tamil { get; } = new ScriptKind(TamilValue); + /// Script name for the Telugu script. + public static ScriptKind Telugu { get; } = new ScriptKind(TeluguValue); + /// Script name for the Thaana script. + public static ScriptKind Thaana { get; } = new ScriptKind(ThaanaValue); + /// Script name for the Thai script. + public static ScriptKind Thai { get; } = new ScriptKind(ThaiValue); + /// Script name for the Tibetan script. + public static ScriptKind Tibetan { get; } = new ScriptKind(TibetanValue); + /// Determines if two values are the same. + public static bool operator ==(ScriptKind left, ScriptKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ScriptKind left, ScriptKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ScriptKind(string value) => new ScriptKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ScriptKind other && Equals(other); + /// + public bool Equals(ScriptKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.Serialization.cs new file mode 100644 index 0000000000000..a32e850dda572 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.Serialization.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentenceAssessment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("isNegated"u8); + writer.WriteBooleanValue(IsNegated); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentenceAssessment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentenceAssessment(document.RootElement, options); + } + + internal static SentenceAssessment DeserializeSentenceAssessment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TokenSentiment sentiment = default; + TargetConfidenceScoreLabel confidenceScores = default; + int offset = default; + int length = default; + string text = default; + bool isNegated = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToTokenSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = TargetConfidenceScoreLabel.DeserializeTargetConfidenceScoreLabel(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("isNegated"u8)) + { + isNegated = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentenceAssessment( + sentiment, + confidenceScores, + offset, + length, + text, + isNegated, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support writing '{options.Format}' format."); + } + } + + SentenceAssessment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentenceAssessment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentenceAssessment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentenceAssessment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentenceAssessment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.cs new file mode 100644 index 0000000000000..fbaf480528616 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceAssessment.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents a sentence assessment and the assessments or target objects related to it. + public partial class SentenceAssessment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The indicator representing if the assessment is negated. + /// or is null. + internal SentenceAssessment(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, bool isNegated) + { + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(text, nameof(text)); + + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + IsNegated = isNegated; + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The indicator representing if the assessment is negated. + /// Keeps track of any properties unknown to the library. + internal SentenceAssessment(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, bool isNegated, IDictionary serializedAdditionalRawData) + { + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + IsNegated = isNegated; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentenceAssessment() + { + } + + /// The sentiment of the sentence. + public TokenSentiment Sentiment { get; } + /// Represents the confidence scores across all sentiment classes: positive and negative. + public TargetConfidenceScoreLabel ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + /// The target text detected. + public string Text { get; } + /// The indicator representing if the assessment is negated. + public bool IsNegated { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.Serialization.cs new file mode 100644 index 0000000000000..08dcd72d4b583 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentenceSentiment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (Optional.IsCollectionDefined(Targets)) + { + writer.WritePropertyName("targets"u8); + writer.WriteStartArray(); + foreach (var item in Targets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Assessments)) + { + writer.WritePropertyName("assessments"u8); + writer.WriteStartArray(); + foreach (var item in Assessments) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentenceSentiment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentenceSentiment(document.RootElement, options); + } + + internal static SentenceSentiment DeserializeSentenceSentiment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + SentenceSentimentValue sentiment = default; + SentimentConfidenceScores confidenceScores = default; + int offset = default; + int length = default; + IReadOnlyList targets = default; + IReadOnlyList assessments = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToSentenceSentimentValue(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("targets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceTarget.DeserializeSentenceTarget(item, options)); + } + targets = array; + continue; + } + if (property.NameEquals("assessments"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceAssessment.DeserializeSentenceAssessment(item, options)); + } + assessments = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentenceSentiment( + text, + sentiment, + confidenceScores, + offset, + length, + targets ?? new ChangeTrackingList(), + assessments ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support writing '{options.Format}' format."); + } + } + + SentenceSentiment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentenceSentiment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentenceSentiment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentenceSentiment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentenceSentiment(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.cs new file mode 100644 index 0000000000000..ce83e918a398e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentiment.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A document's sentence sentiment. + public partial class SentenceSentiment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// or is null. + internal SentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length) + { + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Targets = new ChangeTrackingList(); + Assessments = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The sentence text. + /// The predicted Sentiment for the sentence. + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The array of sentence targets for the sentence. + /// The array of assessments for the sentence. + /// Keeps track of any properties unknown to the library. + internal SentenceSentiment(string text, SentenceSentimentValue sentiment, SentimentConfidenceScores confidenceScores, int offset, int length, IReadOnlyList targets, IReadOnlyList assessments, IDictionary serializedAdditionalRawData) + { + Text = text; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Targets = targets; + Assessments = assessments; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentenceSentiment() + { + } + + /// The sentence text. + public string Text { get; } + /// The predicted Sentiment for the sentence. + public SentenceSentimentValue Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + /// The array of sentence targets for the sentence. + public IReadOnlyList Targets { get; } + /// The array of assessments for the sentence. + public IReadOnlyList Assessments { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.Serialization.cs new file mode 100644 index 0000000000000..9bdcfd27a1792 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class SentenceSentimentValueExtensions + { + public static string ToSerialString(this SentenceSentimentValue value) => value switch + { + SentenceSentimentValue.Positive => "positive", + SentenceSentimentValue.Neutral => "neutral", + SentenceSentimentValue.Negative => "negative", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SentenceSentimentValue value.") + }; + + public static SentenceSentimentValue ToSentenceSentimentValue(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return SentenceSentimentValue.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "neutral")) return SentenceSentimentValue.Neutral; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return SentenceSentimentValue.Negative; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SentenceSentimentValue value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.cs new file mode 100644 index 0000000000000..e148f5d0777a4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceSentimentValue.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// The predicted Sentiment for the sentence. + public enum SentenceSentimentValue + { + /// Positive sentiment. + Positive, + /// Neutral sentiment. + Neutral, + /// Negative sentiment. + Negative + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.Serialization.cs new file mode 100644 index 0000000000000..eb67fae6d6e01 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentenceTarget : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceTarget)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + writer.WritePropertyName("relations"u8); + writer.WriteStartArray(); + foreach (var item in Relations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentenceTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentenceTarget)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentenceTarget(document.RootElement, options); + } + + internal static SentenceTarget DeserializeSentenceTarget(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TokenSentiment sentiment = default; + TargetConfidenceScoreLabel confidenceScores = default; + int offset = default; + int length = default; + string text = default; + IReadOnlyList relations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToTokenSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = TargetConfidenceScoreLabel.DeserializeTargetConfidenceScoreLabel(property.Value, options); + continue; + } + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("relations"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TargetRelation.DeserializeTargetRelation(item, options)); + } + relations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentenceTarget( + sentiment, + confidenceScores, + offset, + length, + text, + relations, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentenceTarget)} does not support writing '{options.Format}' format."); + } + } + + SentenceTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentenceTarget(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentenceTarget)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentenceTarget FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentenceTarget(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.cs new file mode 100644 index 0000000000000..ad9d3bca16f9d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentenceTarget.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents a sentence target and the assessments or target objects related to it. + public partial class SentenceTarget + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The array of either assessment or target objects which is related to the target. + /// , or is null. + internal SentenceTarget(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IEnumerable relations) + { + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(text, nameof(text)); + Argument.AssertNotNull(relations, nameof(relations)); + + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + Relations = relations.ToList(); + } + + /// Initializes a new instance of . + /// The sentiment of the sentence. + /// Represents the confidence scores across all sentiment classes: positive and negative. + /// The target offset from the start of the sentence. + /// The length of the target. + /// The target text detected. + /// The array of either assessment or target objects which is related to the target. + /// Keeps track of any properties unknown to the library. + internal SentenceTarget(TokenSentiment sentiment, TargetConfidenceScoreLabel confidenceScores, int offset, int length, string text, IReadOnlyList relations, IDictionary serializedAdditionalRawData) + { + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Offset = offset; + Length = length; + Text = text; + Relations = relations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentenceTarget() + { + } + + /// The sentiment of the sentence. + public TokenSentiment Sentiment { get; } + /// Represents the confidence scores across all sentiment classes: positive and negative. + public TargetConfidenceScoreLabel ConfidenceScores { get; } + /// The target offset from the start of the sentence. + public int Offset { get; } + /// The length of the target. + public int Length { get; } + /// The target text detected. + public string Text { get; } + /// The array of either assessment or target objects which is related to the target. + public IReadOnlyList Relations { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.Serialization.cs new file mode 100644 index 0000000000000..2eff4c4149aad --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentimentAnalysisActionContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support writing '{format}' format."); + } + + 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(OpinionMining)) + { + writer.WritePropertyName("opinionMining"u8); + writer.WriteBooleanValue(OpinionMining.Value); + } + if (Optional.IsDefined(StringIndexType)) + { + writer.WritePropertyName("stringIndexType"u8); + writer.WriteStringValue(StringIndexType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentimentAnalysisActionContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentAnalysisActionContent(document.RootElement, options); + } + + internal static SentimentAnalysisActionContent DeserializeSentimentAnalysisActionContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? loggingOptOut = default; + string modelVersion = default; + bool? opinionMining = default; + StringIndexType? stringIndexType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("loggingOptOut"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loggingOptOut = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("opinionMining"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + opinionMining = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("stringIndexType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + stringIndexType = new StringIndexType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentAnalysisActionContent(loggingOptOut, modelVersion, opinionMining, stringIndexType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support writing '{options.Format}' format."); + } + } + + SentimentAnalysisActionContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentAnalysisActionContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentAnalysisActionContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentAnalysisActionContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentAnalysisActionContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.cs new file mode 100644 index 0000000000000..e42eb413b63bc --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisActionContent.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Supported parameters for a Sentiment Analysis task. + public partial class SentimentAnalysisActionContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SentimentAnalysisActionContent() + { + } + + /// Initializes a new instance of . + /// logging opt out. + /// model version. + /// Whether to use opinion mining in the request or not. + /// Specifies the method used to interpret string offsets. + /// Keeps track of any properties unknown to the library. + internal SentimentAnalysisActionContent(bool? loggingOptOut, string modelVersion, bool? opinionMining, StringIndexType? stringIndexType, IDictionary serializedAdditionalRawData) + { + LoggingOptOut = loggingOptOut; + ModelVersion = modelVersion; + OpinionMining = opinionMining; + StringIndexType = stringIndexType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// logging opt out. + public bool? LoggingOptOut { get; set; } + /// model version. + public string ModelVersion { get; set; } + /// Whether to use opinion mining in the request or not. + public bool? OpinionMining { get; set; } + /// Specifies the method used to interpret string offsets. + public StringIndexType? StringIndexType { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.Serialization.cs new file mode 100644 index 0000000000000..ed6e3c5f691c0 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.Serialization.cs @@ -0,0 +1,161 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentimentAnalysisOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + SentimentAnalysisOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentAnalysisOperationAction(document.RootElement, options); + } + + internal static SentimentAnalysisOperationAction DeserializeSentimentAnalysisOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SentimentAnalysisActionContent parameters = default; + string taskName = default; + AnalyzeTextOperationActionKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = SentimentAnalysisActionContent.DeserializeSentimentAnalysisActionContent(property.Value, options); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentAnalysisOperationAction(taskName, kind, serializedAdditionalRawData, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support writing '{options.Format}' format."); + } + } + + SentimentAnalysisOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentAnalysisOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentAnalysisOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SentimentAnalysisOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentAnalysisOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.cs new file mode 100644 index 0000000000000..53b0c39a04eba --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentAnalysisOperationAction.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// An object representing the task definition for a Sentiment Analysis task. + public partial class SentimentAnalysisOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + public SentimentAnalysisOperationAction() + { + Kind = AnalyzeTextOperationActionKind.SentimentAnalysis; + } + + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Parameters for the Sentiment Analysis task. + internal SentimentAnalysisOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData, SentimentAnalysisActionContent actionContent) : base(name, kind, serializedAdditionalRawData) + { + ActionContent = actionContent; + } + + /// Parameters for the Sentiment Analysis task. + public SentimentAnalysisActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.Serialization.cs new file mode 100644 index 0000000000000..5a8b95890d672 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentimentConfidenceScores : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("positive"u8); + writer.WriteNumberValue(Positive); + writer.WritePropertyName("neutral"u8); + writer.WriteNumberValue(Neutral); + writer.WritePropertyName("negative"u8); + writer.WriteNumberValue(Negative); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentimentConfidenceScores IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentConfidenceScores(document.RootElement, options); + } + + internal static SentimentConfidenceScores DeserializeSentimentConfidenceScores(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double positive = default; + double neutral = default; + double negative = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("positive"u8)) + { + positive = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("neutral"u8)) + { + neutral = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("negative"u8)) + { + negative = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentConfidenceScores(positive, neutral, negative, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support writing '{options.Format}' format."); + } + } + + SentimentConfidenceScores IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentConfidenceScores(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentConfidenceScores)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentConfidenceScores FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentConfidenceScores(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.cs new file mode 100644 index 0000000000000..6d065b325f997 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentConfidenceScores.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the confidence scores between 0 and 1 across all sentiment classes: positive, neutral, negative. + public partial class SentimentConfidenceScores + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for neutral sentiment. + /// Confidence score for negative sentiment. + internal SentimentConfidenceScores(double positive, double neutral, double negative) + { + Positive = positive; + Neutral = neutral; + Negative = negative; + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for neutral sentiment. + /// Confidence score for negative sentiment. + /// Keeps track of any properties unknown to the library. + internal SentimentConfidenceScores(double positive, double neutral, double negative, IDictionary serializedAdditionalRawData) + { + Positive = positive; + Neutral = neutral; + Negative = negative; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentimentConfidenceScores() + { + } + + /// Confidence score for positive sentiment. + public double Positive { get; } + /// Confidence score for neutral sentiment. + public double Neutral { get; } + /// Confidence score for negative sentiment. + public double Negative { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.Serialization.cs new file mode 100644 index 0000000000000..5db596c18ccb5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentimentDocumentResultWithDetectedLanguage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentDocumentResultWithDetectedLanguage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("warnings"u8); + writer.WriteStartArray(); + foreach (var item in Warnings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(Statistics)) + { + writer.WritePropertyName("statistics"u8); + writer.WriteObjectValue(Statistics, options); + } + writer.WritePropertyName("sentiment"u8); + writer.WriteStringValue(Sentiment.ToSerialString()); + writer.WritePropertyName("confidenceScores"u8); + writer.WriteObjectValue(ConfidenceScores, options); + writer.WritePropertyName("sentences"u8); + writer.WriteStartArray(); + foreach (var item in Sentences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(DetectedLanguage)) + { + writer.WritePropertyName("detectedLanguage"u8); + writer.WriteObjectValue(DetectedLanguage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentimentDocumentResultWithDetectedLanguage 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(SentimentDocumentResultWithDetectedLanguage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentDocumentResultWithDetectedLanguage(document.RootElement, options); + } + + internal static SentimentDocumentResultWithDetectedLanguage DeserializeSentimentDocumentResultWithDetectedLanguage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + IReadOnlyList warnings = default; + DocumentStatistics statistics = default; + DocumentSentiment sentiment = default; + SentimentConfidenceScores confidenceScores = default; + IReadOnlyList sentences = default; + DetectedLanguage detectedLanguage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("warnings"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentWarning.DeserializeDocumentWarning(item, options)); + } + warnings = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = DocumentStatistics.DeserializeDocumentStatistics(property.Value, options); + continue; + } + if (property.NameEquals("sentiment"u8)) + { + sentiment = property.Value.GetString().ToDocumentSentiment(); + continue; + } + if (property.NameEquals("confidenceScores"u8)) + { + confidenceScores = SentimentConfidenceScores.DeserializeSentimentConfidenceScores(property.Value, options); + continue; + } + if (property.NameEquals("sentences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentenceSentiment.DeserializeSentenceSentiment(item, options)); + } + sentences = array; + continue; + } + if (property.NameEquals("detectedLanguage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detectedLanguage = DetectedLanguage.DeserializeDetectedLanguage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentDocumentResultWithDetectedLanguage( + id, + warnings, + statistics, + sentiment, + confidenceScores, + sentences, + detectedLanguage, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentDocumentResultWithDetectedLanguage)} does not support writing '{options.Format}' format."); + } + } + + SentimentDocumentResultWithDetectedLanguage 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 DeserializeSentimentDocumentResultWithDetectedLanguage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentDocumentResultWithDetectedLanguage)} 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 SentimentDocumentResultWithDetectedLanguage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentDocumentResultWithDetectedLanguage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.cs new file mode 100644 index 0000000000000..f311c39c02517 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentDocumentResultWithDetectedLanguage.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Sentiment analysis per document. + public partial class SentimentDocumentResultWithDetectedLanguage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// , , or is null. + internal SentimentDocumentResultWithDetectedLanguage(string id, IEnumerable warnings, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IEnumerable sentences) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(warnings, nameof(warnings)); + Argument.AssertNotNull(confidenceScores, nameof(confidenceScores)); + Argument.AssertNotNull(sentences, nameof(sentences)); + + Id = id; + Warnings = warnings.ToList(); + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences.ToList(); + } + + /// Initializes a new instance of . + /// Unique, non-empty document identifier. + /// Warnings encountered while processing document. + /// if showStats=true was specified in the request this field will contain information about the document payload. + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + /// The document's sentences sentiment. + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + /// Keeps track of any properties unknown to the library. + internal SentimentDocumentResultWithDetectedLanguage(string id, IReadOnlyList warnings, DocumentStatistics statistics, DocumentSentiment sentiment, SentimentConfidenceScores confidenceScores, IReadOnlyList sentences, DetectedLanguage detectedLanguage, IDictionary serializedAdditionalRawData) + { + Id = id; + Warnings = warnings; + Statistics = statistics; + Sentiment = sentiment; + ConfidenceScores = confidenceScores; + Sentences = sentences; + DetectedLanguage = detectedLanguage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentimentDocumentResultWithDetectedLanguage() + { + } + + /// Unique, non-empty document identifier. + public string Id { get; } + /// Warnings encountered while processing document. + public IReadOnlyList Warnings { get; } + /// if showStats=true was specified in the request this field will contain information about the document payload. + public DocumentStatistics Statistics { get; } + /// Predicted sentiment for document (Negative, Neutral, Positive, or Mixed). + public DocumentSentiment Sentiment { get; } + /// The sentiment confidence score between 0 and 1 for the sentence for all classes. + public SentimentConfidenceScores ConfidenceScores { get; } + /// The document's sentences sentiment. + public IReadOnlyList Sentences { get; } + /// If 'language' is set to 'auto' for the document in the request this field will contain a 2 letter ISO 639-1 representation of the language detected for this document. + public DetectedLanguage DetectedLanguage { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.Serialization.cs new file mode 100644 index 0000000000000..9ee43f39b16be --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentimentOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SentimentOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentOperationResult(document.RootElement, options); + } + + internal static SentimentOperationResult DeserializeSentimentOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SentimentResult results = default; + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("results"u8)) + { + results = SentimentResult.DeserializeSentimentResult(property.Value, options); + continue; + } + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentOperationResult( + lastUpdateDateTime, + status, + taskName, + kind, + serializedAdditionalRawData, + results); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support writing '{options.Format}' format."); + } + } + + SentimentOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SentimentOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.cs new file mode 100644 index 0000000000000..6d2f72f5bc833 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentOperationResult.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the Sentiment Analysis LRO results. + public partial class SentimentOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// The sentiment analysis results. + /// is null. + internal SentimentOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, SentimentResult results) : base(lastUpdateDateTime, status) + { + Argument.AssertNotNull(results, nameof(results)); + + Kind = AnalyzeTextOperationResultsKind.SentimentAnalysisOperationResults; + Results = results; + } + + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + /// The sentiment analysis results. + internal SentimentOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData, SentimentResult results) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + Results = results; + } + + /// Initializes a new instance of for deserialization. + internal SentimentOperationResult() + { + } + + /// The sentiment analysis results. + public SentimentResult Results { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.Serialization.cs new file mode 100644 index 0000000000000..8f3b4415475df --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.Serialization.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SentimentResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + SentimentResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SentimentResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSentimentResult(document.RootElement, options); + } + + internal static SentimentResult DeserializeSentimentResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList errors = default; + RequestStatistics statistics = default; + string modelVersion = default; + IReadOnlyList documents = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errors"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DocumentError.DeserializeDocumentError(item, options)); + } + errors = array; + continue; + } + if (property.NameEquals("statistics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statistics = RequestStatistics.DeserializeRequestStatistics(property.Value, options); + continue; + } + if (property.NameEquals("modelVersion"u8)) + { + modelVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("documents"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SentimentDocumentResultWithDetectedLanguage.DeserializeSentimentDocumentResultWithDetectedLanguage(item, options)); + } + documents = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SentimentResult(errors, statistics, modelVersion, documents, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SentimentResult)} does not support writing '{options.Format}' format."); + } + } + + SentimentResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSentimentResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SentimentResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SentimentResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSentimentResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.cs new file mode 100644 index 0000000000000..29b87fc71dc44 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SentimentResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Language.Text.Models +{ + /// Sentiment analysis results for the input documents. + public partial class SentimentResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Errors by document id. + /// This field indicates which model is used for scoring. + /// The sentiment analysis results for each document in the input. + /// , or is null. + internal SentimentResult(IEnumerable errors, string modelVersion, IEnumerable documents) + { + Argument.AssertNotNull(errors, nameof(errors)); + Argument.AssertNotNull(modelVersion, nameof(modelVersion)); + Argument.AssertNotNull(documents, nameof(documents)); + + Errors = errors.ToList(); + ModelVersion = modelVersion; + Documents = documents.ToList(); + } + + /// Initializes a new instance of . + /// Errors by document id. + /// if showStats=true was specified in the request this field will contain information about the request payload. + /// This field indicates which model is used for scoring. + /// The sentiment analysis results for each document in the input. + /// Keeps track of any properties unknown to the library. + internal SentimentResult(IReadOnlyList errors, RequestStatistics statistics, string modelVersion, IReadOnlyList documents, IDictionary serializedAdditionalRawData) + { + Errors = errors; + Statistics = statistics; + ModelVersion = modelVersion; + Documents = documents; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SentimentResult() + { + } + + /// Errors by document id. + public IReadOnlyList Errors { get; } + /// if showStats=true was specified in the request this field will contain information about the request payload. + public RequestStatistics Statistics { get; } + /// This field indicates which model is used for scoring. + public string ModelVersion { get; } + /// The sentiment analysis results for each document in the input. + public IReadOnlyList Documents { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.Serialization.cs new file mode 100644 index 0000000000000..33891450a835f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SpeedMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SpeedMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSpeedMetadata(document.RootElement, options); + } + + internal static SpeedMetadata DeserializeSpeedMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + SpeedUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new SpeedUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SpeedMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support writing '{options.Format}' format."); + } + } + + SpeedMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSpeedMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SpeedMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SpeedMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSpeedMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.cs new file mode 100644 index 0000000000000..22d45bb0b0f8c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Speed entity Metadata model. + public partial class SpeedMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for speed. + internal SpeedMetadata(double value, SpeedUnit unit) + { + MetadataKind = MetadataKind.SpeedMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for speed. + internal SpeedMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, SpeedUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal SpeedMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for speed. + public SpeedUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedUnit.cs new file mode 100644 index 0000000000000..d21366a52d47c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SpeedUnit.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The speed Unit of measurement. + public readonly partial struct SpeedUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SpeedUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string MetersPerSecondValue = "MetersPerSecond"; + private const string KilometersPerHourValue = "KilometersPerHour"; + private const string KilometersPerMinuteValue = "KilometersPerMinute"; + private const string KilometersPerSecondValue = "KilometersPerSecond"; + private const string MilesPerHourValue = "MilesPerHour"; + private const string KnotsValue = "Knots"; + private const string FeetPerSecondValue = "FeetPerSecond"; + private const string FeetPerMinuteValue = "FeetPerMinute"; + private const string YardsPerMinuteValue = "YardsPerMinute"; + private const string YardsPerSecondValue = "YardsPerSecond"; + private const string MetersPerMillisecondValue = "MetersPerMillisecond"; + private const string CentimetersPerMillisecondValue = "CentimetersPerMillisecond"; + private const string KilometersPerMillisecondValue = "KilometersPerMillisecond"; + + /// Unspecified speed unit. + public static SpeedUnit Unspecified { get; } = new SpeedUnit(UnspecifiedValue); + /// Speed unit in meters per second. + public static SpeedUnit MetersPerSecond { get; } = new SpeedUnit(MetersPerSecondValue); + /// Speed unit in kilometers per hour. + public static SpeedUnit KilometersPerHour { get; } = new SpeedUnit(KilometersPerHourValue); + /// Speed unit in kilometers per minute. + public static SpeedUnit KilometersPerMinute { get; } = new SpeedUnit(KilometersPerMinuteValue); + /// Speed unit in kilometers per second. + public static SpeedUnit KilometersPerSecond { get; } = new SpeedUnit(KilometersPerSecondValue); + /// Speed unit in miles per hour. + public static SpeedUnit MilesPerHour { get; } = new SpeedUnit(MilesPerHourValue); + /// Speed unit in knots. + public static SpeedUnit Knots { get; } = new SpeedUnit(KnotsValue); + /// Speed unit in feet per second. + public static SpeedUnit FeetPerSecond { get; } = new SpeedUnit(FeetPerSecondValue); + /// Speed unit in feet per minute. + public static SpeedUnit FeetPerMinute { get; } = new SpeedUnit(FeetPerMinuteValue); + /// Speed unit in yards per minute. + public static SpeedUnit YardsPerMinute { get; } = new SpeedUnit(YardsPerMinuteValue); + /// Speed unit in yards per second. + public static SpeedUnit YardsPerSecond { get; } = new SpeedUnit(YardsPerSecondValue); + /// Speed unit in meters per millisecond. + public static SpeedUnit MetersPerMillisecond { get; } = new SpeedUnit(MetersPerMillisecondValue); + /// Speed unit in centimeters per millisecond. + public static SpeedUnit CentimetersPerMillisecond { get; } = new SpeedUnit(CentimetersPerMillisecondValue); + /// Speed unit in Kilometers per millisecond. + public static SpeedUnit KilometersPerMillisecond { get; } = new SpeedUnit(KilometersPerMillisecondValue); + /// Determines if two values are the same. + public static bool operator ==(SpeedUnit left, SpeedUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SpeedUnit left, SpeedUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SpeedUnit(string value) => new SpeedUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SpeedUnit other && Equals(other); + /// + public bool Equals(SpeedUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/StringIndexType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/StringIndexType.cs new file mode 100644 index 0000000000000..ef2d31337c9e3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/StringIndexType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.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. + 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 string to a . + public static implicit operator StringIndexType(string value) => new StringIndexType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StringIndexType other && Equals(other); + /// + public bool Equals(StringIndexType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.Serialization.cs new file mode 100644 index 0000000000000..b6261566b07c1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class SummaryContext : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummaryContext)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("offset"u8); + writer.WriteNumberValue(Offset); + writer.WritePropertyName("length"u8); + writer.WriteNumberValue(Length); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SummaryContext IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SummaryContext)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSummaryContext(document.RootElement, options); + } + + internal static SummaryContext DeserializeSummaryContext(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int offset = default; + int length = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("offset"u8)) + { + offset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("length"u8)) + { + length = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SummaryContext(offset, length, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SummaryContext)} does not support writing '{options.Format}' format."); + } + } + + SummaryContext IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSummaryContext(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SummaryContext)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SummaryContext FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSummaryContext(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.cs new file mode 100644 index 0000000000000..0a7e80661f5ef --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryContext.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The context of the summary. + public partial class SummaryContext + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + internal SummaryContext(int offset, int length) + { + Offset = offset; + Length = length; + } + + /// Initializes a new instance of . + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + /// Keeps track of any properties unknown to the library. + internal SummaryContext(int offset, int length, IDictionary serializedAdditionalRawData) + { + Offset = offset; + Length = length; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SummaryContext() + { + } + + /// Start position for the context. Use of different 'stringIndexType' values can affect the offset returned. + public int Offset { get; } + /// The length of the context. Use of different 'stringIndexType' values can affect the length returned. + public int Length { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryLengthBucket.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryLengthBucket.cs new file mode 100644 index 0000000000000..3c338de3eed21 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/SummaryLengthBucket.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// 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 string to a . + public static implicit operator SummaryLengthBucket(string value) => new SummaryLengthBucket(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SummaryLengthBucket other && Equals(other); + /// + public bool Equals(SummaryLengthBucket other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs new file mode 100644 index 0000000000000..a72d56071d274 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TargetConfidenceScoreLabel : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("positive"u8); + writer.WriteNumberValue(Positive); + writer.WritePropertyName("negative"u8); + writer.WriteNumberValue(Negative); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TargetConfidenceScoreLabel IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetConfidenceScoreLabel(document.RootElement, options); + } + + internal static TargetConfidenceScoreLabel DeserializeTargetConfidenceScoreLabel(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double positive = default; + double negative = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("positive"u8)) + { + positive = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("negative"u8)) + { + negative = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetConfidenceScoreLabel(positive, negative, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support writing '{options.Format}' format."); + } + } + + TargetConfidenceScoreLabel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetConfidenceScoreLabel(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetConfidenceScoreLabel)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TargetConfidenceScoreLabel FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTargetConfidenceScoreLabel(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.cs new file mode 100644 index 0000000000000..8524c6d3acec7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetConfidenceScoreLabel.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the confidence scores across all sentiment classes: positive and negative. + public partial class TargetConfidenceScoreLabel + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for negative sentiment. + internal TargetConfidenceScoreLabel(double positive, double negative) + { + Positive = positive; + Negative = negative; + } + + /// Initializes a new instance of . + /// Confidence score for positive sentiment. + /// Confidence score for negative sentiment. + /// Keeps track of any properties unknown to the library. + internal TargetConfidenceScoreLabel(double positive, double negative, IDictionary serializedAdditionalRawData) + { + Positive = positive; + Negative = negative; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetConfidenceScoreLabel() + { + } + + /// Confidence score for positive sentiment. + public double Positive { get; } + /// Confidence score for negative sentiment. + public double Negative { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.Serialization.cs new file mode 100644 index 0000000000000..20d27a45fcd0c --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TargetRelation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetRelation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("ref"u8); + writer.WriteStringValue(Ref); + writer.WritePropertyName("relationType"u8); + writer.WriteStringValue(RelationType.ToSerialString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TargetRelation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetRelation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetRelation(document.RootElement, options); + } + + internal static TargetRelation DeserializeTargetRelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @ref = default; + TargetRelationType relationType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ref"u8)) + { + @ref = property.Value.GetString(); + continue; + } + if (property.NameEquals("relationType"u8)) + { + relationType = property.Value.GetString().ToTargetRelationType(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetRelation(@ref, relationType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetRelation)} does not support writing '{options.Format}' format."); + } + } + + TargetRelation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetRelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetRelation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TargetRelation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTargetRelation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.cs new file mode 100644 index 0000000000000..94e52df4a93dd --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelation.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the relation between assessments and/or targets. + public partial class TargetRelation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The JSON pointer indicating the linked object. + /// The type related to the target. + /// is null. + internal TargetRelation(string @ref, TargetRelationType relationType) + { + Argument.AssertNotNull(@ref, nameof(@ref)); + + Ref = @ref; + RelationType = relationType; + } + + /// Initializes a new instance of . + /// The JSON pointer indicating the linked object. + /// The type related to the target. + /// Keeps track of any properties unknown to the library. + internal TargetRelation(string @ref, TargetRelationType relationType, IDictionary serializedAdditionalRawData) + { + Ref = @ref; + RelationType = relationType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetRelation() + { + } + + /// The JSON pointer indicating the linked object. + public string Ref { get; } + /// The type related to the target. + public TargetRelationType RelationType { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.Serialization.cs new file mode 100644 index 0000000000000..7bf42eac346ec --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class TargetRelationTypeExtensions + { + public static string ToSerialString(this TargetRelationType value) => value switch + { + TargetRelationType.Assessment => "assessment", + TargetRelationType.Target => "target", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TargetRelationType value.") + }; + + public static TargetRelationType ToTargetRelationType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "assessment")) return TargetRelationType.Assessment; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "target")) return TargetRelationType.Target; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TargetRelationType value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.cs new file mode 100644 index 0000000000000..3983dbddd3076 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TargetRelationType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// The type related to the target. + public enum TargetRelationType + { + /// Assessment relation. + Assessment, + /// Target relation. + Target + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.Serialization.cs new file mode 100644 index 0000000000000..d3c3555823832 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TemperatureMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TemperatureMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemperatureMetadata(document.RootElement, options); + } + + internal static TemperatureMetadata DeserializeTemperatureMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + TemperatureUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new TemperatureUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemperatureMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support writing '{options.Format}' format."); + } + } + + TemperatureMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemperatureMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemperatureMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemperatureMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemperatureMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.cs new file mode 100644 index 0000000000000..e04d2356e1d80 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Information entity Metadata model. + public partial class TemperatureMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for temperature. + internal TemperatureMetadata(double value, TemperatureUnit unit) + { + MetadataKind = MetadataKind.TemperatureMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for temperature. + internal TemperatureMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, TemperatureUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal TemperatureMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for temperature. + public TemperatureUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureUnit.cs new file mode 100644 index 0000000000000..60574e3bf7223 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemperatureUnit.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The temperature Unit of measurement. + public readonly partial struct TemperatureUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemperatureUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string FahrenheitValue = "Fahrenheit"; + private const string KelvinValue = "Kelvin"; + private const string RankineValue = "Rankine"; + private const string CelsiusValue = "Celsius"; + + /// Unspecified temperature unit. + public static TemperatureUnit Unspecified { get; } = new TemperatureUnit(UnspecifiedValue); + /// Temperature unit in Fahrenheit. + public static TemperatureUnit Fahrenheit { get; } = new TemperatureUnit(FahrenheitValue); + /// Temperature unit in Kelvin. + public static TemperatureUnit Kelvin { get; } = new TemperatureUnit(KelvinValue); + /// Temperature unit in Rankine. + public static TemperatureUnit Rankine { get; } = new TemperatureUnit(RankineValue); + /// Temperature unit in Celsius. + public static TemperatureUnit Celsius { get; } = new TemperatureUnit(CelsiusValue); + /// Determines if two values are the same. + public static bool operator ==(TemperatureUnit left, TemperatureUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemperatureUnit left, TemperatureUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TemperatureUnit(string value) => new TemperatureUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemperatureUnit other && Equals(other); + /// + public bool Equals(TemperatureUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalModifier.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalModifier.cs new file mode 100644 index 0000000000000..70e26986fcba8 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalModifier.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// An optional modifier of a date/time instance. + public readonly partial struct TemporalModifier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TemporalModifier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AfterApproxValue = "AfterApprox"; + private const string BeforeValue = "Before"; + private const string BeforeStartValue = "BeforeStart"; + private const string ApproxValue = "Approx"; + private const string ReferenceUndefinedValue = "ReferenceUndefined"; + private const string SinceEndValue = "SinceEnd"; + private const string AfterMidValue = "AfterMid"; + private const string StartValue = "Start"; + private const string AfterValue = "After"; + private const string BeforeEndValue = "BeforeEnd"; + private const string UntilValue = "Until"; + private const string EndValue = "End"; + private const string LessValue = "Less"; + private const string SinceValue = "Since"; + private const string AfterStartValue = "AfterStart"; + private const string BeforeApproxValue = "BeforeApprox"; + private const string MidValue = "Mid"; + private const string MoreValue = "More"; + + /// After an approximate time. + public static TemporalModifier AfterApprox { get; } = new TemporalModifier(AfterApproxValue); + /// Before a specific time. + public static TemporalModifier Before { get; } = new TemporalModifier(BeforeValue); + /// Before the start of a time period. + public static TemporalModifier BeforeStart { get; } = new TemporalModifier(BeforeStartValue); + /// Approximately at a specific time. + public static TemporalModifier Approx { get; } = new TemporalModifier(ApproxValue); + /// Reference to an undefined time. + public static TemporalModifier ReferenceUndefined { get; } = new TemporalModifier(ReferenceUndefinedValue); + /// Since the end of a time period. + public static TemporalModifier SinceEnd { get; } = new TemporalModifier(SinceEndValue); + /// After the middle of a time period. + public static TemporalModifier AfterMid { get; } = new TemporalModifier(AfterMidValue); + /// At the start of a time period. + public static TemporalModifier Start { get; } = new TemporalModifier(StartValue); + /// After a specific time. + public static TemporalModifier After { get; } = new TemporalModifier(AfterValue); + /// Before the end of a time period. + public static TemporalModifier BeforeEnd { get; } = new TemporalModifier(BeforeEndValue); + /// Until a specific time. + public static TemporalModifier Until { get; } = new TemporalModifier(UntilValue); + /// At the end of a time period. + public static TemporalModifier End { get; } = new TemporalModifier(EndValue); + /// Less than a specific time. + public static TemporalModifier Less { get; } = new TemporalModifier(LessValue); + /// Since a specific time. + public static TemporalModifier Since { get; } = new TemporalModifier(SinceValue); + /// After the start of a time period. + public static TemporalModifier AfterStart { get; } = new TemporalModifier(AfterStartValue); + /// Before an approximate time. + public static TemporalModifier BeforeApprox { get; } = new TemporalModifier(BeforeApproxValue); + /// In the middle of a time period. + public static TemporalModifier Mid { get; } = new TemporalModifier(MidValue); + /// More than a specific time. + public static TemporalModifier More { get; } = new TemporalModifier(MoreValue); + /// Determines if two values are the same. + public static bool operator ==(TemporalModifier left, TemporalModifier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TemporalModifier left, TemporalModifier right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TemporalModifier(string value) => new TemporalModifier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TemporalModifier other && Equals(other); + /// + public bool Equals(TemporalModifier other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.Serialization.cs new file mode 100644 index 0000000000000..c09455d60685a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TemporalSetMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TemporalSetMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSetMetadata(document.RootElement, options); + } + + internal static TemporalSetMetadata DeserializeTemporalSetMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSetMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support writing '{options.Format}' format."); + } + } + + TemporalSetMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemporalSetMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSetMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemporalSetMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSetMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.cs new file mode 100644 index 0000000000000..54506dfbedc35 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSetMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A Metadata for temporal set entity instances. + public partial class TemporalSetMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal TemporalSetMetadata() + { + MetadataKind = MetadataKind.TemporalSetMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal TemporalSetMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.Serialization.cs new file mode 100644 index 0000000000000..7fe7281b0efb4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TemporalSpanMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(SpanValues)) + { + writer.WritePropertyName("spanValues"u8); + writer.WriteStartArray(); + foreach (var item in SpanValues) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TemporalSpanMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSpanMetadata(document.RootElement, options); + } + + internal static TemporalSpanMetadata DeserializeTemporalSpanMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList spanValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("spanValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TemporalSpanValues.DeserializeTemporalSpanValues(item, options)); + } + spanValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSpanMetadata(metadataKind, serializedAdditionalRawData, spanValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support writing '{options.Format}' format."); + } + } + + TemporalSpanMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemporalSpanMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSpanMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemporalSpanMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSpanMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.cs new file mode 100644 index 0000000000000..6e4df6fd574a9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// represents the Metadata of a date and/or time span. + public partial class TemporalSpanMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal TemporalSpanMetadata() + { + MetadataKind = MetadataKind.TemporalSpanMetadata; + SpanValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of temporal spans detected. + internal TemporalSpanMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList spanValues) : base(metadataKind, serializedAdditionalRawData) + { + SpanValues = spanValues; + } + + /// List of temporal spans detected. + public IReadOnlyList SpanValues { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.Serialization.cs new file mode 100644 index 0000000000000..349464d08f7c1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.Serialization.cs @@ -0,0 +1,192 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TemporalSpanValues : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Begin)) + { + writer.WritePropertyName("begin"u8); + writer.WriteStringValue(Begin); + } + if (Optional.IsDefined(End)) + { + writer.WritePropertyName("end"u8); + writer.WriteStringValue(End); + } + if (Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration); + } + if (Optional.IsDefined(Modifier)) + { + writer.WritePropertyName("modifier"u8); + writer.WriteStringValue(Modifier.Value.ToString()); + } + if (Optional.IsDefined(Timex)) + { + writer.WritePropertyName("timex"u8); + writer.WriteStringValue(Timex); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TemporalSpanValues IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemporalSpanValues(document.RootElement, options); + } + + internal static TemporalSpanValues DeserializeTemporalSpanValues(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string begin = default; + string end = default; + string duration = default; + TemporalModifier? modifier = default; + string timex = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("begin"u8)) + { + begin = property.Value.GetString(); + continue; + } + if (property.NameEquals("end"u8)) + { + end = property.Value.GetString(); + continue; + } + if (property.NameEquals("duration"u8)) + { + duration = property.Value.GetString(); + continue; + } + if (property.NameEquals("modifier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + modifier = new TemporalModifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("timex"u8)) + { + timex = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemporalSpanValues( + begin, + end, + duration, + modifier, + timex, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support writing '{options.Format}' format."); + } + } + + TemporalSpanValues IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTemporalSpanValues(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemporalSpanValues)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TemporalSpanValues FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTemporalSpanValues(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.cs new file mode 100644 index 0000000000000..c25400aad20e1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TemporalSpanValues.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Temporal span object. + public partial class TemporalSpanValues + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal TemporalSpanValues() + { + } + + /// Initializes a new instance of . + /// Start value for the span. + /// End value for the span. + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + /// Modifier for datetime to indicate point of reference like before, after etc. + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + /// Keeps track of any properties unknown to the library. + internal TemporalSpanValues(string begin, string end, string duration, TemporalModifier? modifier, string timex, IDictionary serializedAdditionalRawData) + { + Begin = begin; + End = end; + Duration = duration; + Modifier = modifier; + Timex = timex; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Start value for the span. + public string Begin { get; } + /// End value for the span. + public string End { get; } + /// An optional duration value formatted based on the ISO 8601 (https://en.wikipedia.org/wiki/ISO_8601#Durations). + public string Duration { get; } + /// Modifier for datetime to indicate point of reference like before, after etc. + public TemporalModifier? Modifier { get; } + /// An optional triplet containing the beginning, the end, and the duration all stated as ISO 8601 formatted strings. + public string Timex { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActionState.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActionState.cs new file mode 100644 index 0000000000000..e7fccda0c1966 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActionState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The status of the task at the mentioned last update time. + public readonly partial struct TextActionState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TextActionState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "notStarted"; + private const string RunningValue = "running"; + private const string SucceededValue = "succeeded"; + private const string PartiallyCompletedValue = "partiallyCompleted"; + private const string FailedValue = "failed"; + private const string CancelledValue = "cancelled"; + private const string CancellingValue = "cancelling"; + + /// Not started status. + public static TextActionState NotStarted { get; } = new TextActionState(NotStartedValue); + /// Running status. + public static TextActionState Running { get; } = new TextActionState(RunningValue); + /// Succeeded status. + public static TextActionState Succeeded { get; } = new TextActionState(SucceededValue); + /// Partially completed status. + public static TextActionState PartiallyCompleted { get; } = new TextActionState(PartiallyCompletedValue); + /// Failed status. + public static TextActionState Failed { get; } = new TextActionState(FailedValue); + /// Cancelled status. + public static TextActionState Cancelled { get; } = new TextActionState(CancelledValue); + /// Cancelling status. + public static TextActionState Cancelling { get; } = new TextActionState(CancellingValue); + /// Determines if two values are the same. + public static bool operator ==(TextActionState left, TextActionState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TextActionState left, TextActionState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TextActionState(string value) => new TextActionState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TextActionState other && Equals(other); + /// + public bool Equals(TextActionState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.Serialization.cs new file mode 100644 index 0000000000000..bcdcf9e0c925a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.Serialization.cs @@ -0,0 +1,190 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextActions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextActions)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + TextActions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextActions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextActions(document.RootElement, options); + } + + internal static TextActions DeserializeTextActions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int completed = default; + int failed = default; + int inProgress = default; + int total = default; + IReadOnlyList items = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("completed"u8)) + { + completed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("failed"u8)) + { + failed = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("inProgress"u8)) + { + inProgress = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("total"u8)) + { + total = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("items"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AnalyzeTextOperationResult.DeserializeAnalyzeTextOperationResult(item, options)); + } + items = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextActions( + completed, + failed, + inProgress, + total, + items ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextActions)} does not support writing '{options.Format}' format."); + } + } + + TextActions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextActions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextActions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TextActions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextActions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.cs new file mode 100644 index 0000000000000..4d93b61e9ac93 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextActions.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Container for the tasks status for the LRO job. + public partial class TextActions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + internal TextActions(int completed, int failed, int inProgress, int total) + { + Completed = completed; + Failed = failed; + InProgress = inProgress; + Total = total; + Items = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Count of completed tasks. + /// Count of failed tasks. + /// Count of inprogress tasks. + /// Count of total tasks. + /// + /// Enumerable of Analyze text job results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + /// Keeps track of any properties unknown to the library. + internal TextActions(int completed, int failed, int inProgress, int total, IReadOnlyList items, IDictionary serializedAdditionalRawData) + { + Completed = completed; + Failed = failed; + InProgress = inProgress; + Total = total; + Items = items; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TextActions() + { + } + + /// Count of completed tasks. + public int Completed { get; } + /// Count of failed tasks. + public int Failed { get; } + /// Count of inprogress tasks. + public int InProgress { get; } + /// Count of total tasks. + public int Total { get; } + /// + /// Enumerable of Analyze text job results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , , , , , , , and . + /// + public IReadOnlyList Items { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.Serialization.cs new file mode 100644 index 0000000000000..4f4d7ca91e620 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextDynamicClassificationInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextDynamicClassificationInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextDynamicClassificationInput(document.RootElement, options); + } + + internal static TextDynamicClassificationInput DeserializeTextDynamicClassificationInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + DynamicClassificationActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = DynamicClassificationActionContent.DeserializeDynamicClassificationActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextDynamicClassificationInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support writing '{options.Format}' format."); + } + } + + TextDynamicClassificationInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextDynamicClassificationInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextDynamicClassificationInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextDynamicClassificationInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextDynamicClassificationInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.cs new file mode 100644 index 0000000000000..54980f8f43df7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextDynamicClassificationInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text dynamic classifications input. + public partial class TextDynamicClassificationInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextDynamicClassificationInput() + { + Kind = AnalyzeTextInputKind.DynamicClassification; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Input to be analyzed. + /// Task parameters. + internal TextDynamicClassificationInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, DynamicClassificationActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Input to be analyzed. + public MultiLanguageTextInput TextInput { get; set; } + /// Task parameters. + public DynamicClassificationActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.Serialization.cs new file mode 100644 index 0000000000000..f116b8f66a5ae --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextEntityLinkingInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextEntityLinkingInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextEntityLinkingInput(document.RootElement, options); + } + + internal static TextEntityLinkingInput DeserializeTextEntityLinkingInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + EntityLinkingActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntityLinkingActionContent.DeserializeEntityLinkingActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextEntityLinkingInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support writing '{options.Format}' format."); + } + } + + TextEntityLinkingInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextEntityLinkingInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextEntityLinkingInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextEntityLinkingInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextEntityLinkingInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.cs new file mode 100644 index 0000000000000..70e6d95782f47 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityLinkingInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text Entity linking input. + public partial class TextEntityLinkingInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextEntityLinkingInput() + { + Kind = AnalyzeTextInputKind.EntityLinking; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the analysis input to be handled by the service. + /// Task parameters. + internal TextEntityLinkingInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, EntityLinkingActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the analysis input to be handled by the service. + public MultiLanguageTextInput TextInput { get; set; } + /// Task parameters. + public EntityLinkingActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.Serialization.cs new file mode 100644 index 0000000000000..42910389778ec --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextEntityRecognitionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextEntityRecognitionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextEntityRecognitionInput(document.RootElement, options); + } + + internal static TextEntityRecognitionInput DeserializeTextEntityRecognitionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + EntitiesActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = EntitiesActionContent.DeserializeEntitiesActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextEntityRecognitionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support writing '{options.Format}' format."); + } + } + + TextEntityRecognitionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextEntityRecognitionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextEntityRecognitionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextEntityRecognitionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextEntityRecognitionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.cs new file mode 100644 index 0000000000000..c8c779e79558f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextEntityRecognitionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// The entity recognition analyze text input task request. + public partial class TextEntityRecognitionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextEntityRecognitionInput() + { + Kind = AnalyzeTextInputKind.EntityRecognition; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// The input to be analyzed. + /// Task parameters. + internal TextEntityRecognitionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, EntitiesActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// The input to be analyzed. + public MultiLanguageTextInput TextInput { get; set; } + /// Task parameters. + public EntitiesActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.Serialization.cs new file mode 100644 index 0000000000000..680b8f32ab882 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextKeyPhraseExtractionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextKeyPhraseExtractionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextKeyPhraseExtractionInput(document.RootElement, options); + } + + internal static TextKeyPhraseExtractionInput DeserializeTextKeyPhraseExtractionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + KeyPhraseActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = KeyPhraseActionContent.DeserializeKeyPhraseActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextKeyPhraseExtractionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support writing '{options.Format}' format."); + } + } + + TextKeyPhraseExtractionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextKeyPhraseExtractionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextKeyPhraseExtractionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextKeyPhraseExtractionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextKeyPhraseExtractionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.cs new file mode 100644 index 0000000000000..558b088ef6b4e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextKeyPhraseExtractionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text KeyPhraseExtraction task input. + public partial class TextKeyPhraseExtractionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextKeyPhraseExtractionInput() + { + Kind = AnalyzeTextInputKind.KeyPhraseExtraction; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the input documents. + /// Key phrase extraction task parameters. + internal TextKeyPhraseExtractionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, KeyPhraseActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the input documents. + public MultiLanguageTextInput TextInput { get; set; } + /// Key phrase extraction task parameters. + public KeyPhraseActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.Serialization.cs new file mode 100644 index 0000000000000..69c3910f22f6f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextLanguageDetectionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextLanguageDetectionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextLanguageDetectionInput(document.RootElement, options); + } + + internal static TextLanguageDetectionInput DeserializeTextLanguageDetectionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LanguageDetectionTextInput analysisInput = default; + LanguageDetectionActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = LanguageDetectionTextInput.DeserializeLanguageDetectionTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = LanguageDetectionActionContent.DeserializeLanguageDetectionActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextLanguageDetectionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support writing '{options.Format}' format."); + } + } + + TextLanguageDetectionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextLanguageDetectionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextLanguageDetectionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextLanguageDetectionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextLanguageDetectionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.cs new file mode 100644 index 0000000000000..683f5dc1b5263 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextLanguageDetectionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the language detection document analysis task input. + public partial class TextLanguageDetectionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextLanguageDetectionInput() + { + Kind = AnalyzeTextInputKind.LanguageDetection; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Documents to be analyzed. + /// task parameters. + internal TextLanguageDetectionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, LanguageDetectionTextInput textInput, LanguageDetectionActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Documents to be analyzed. + public LanguageDetectionTextInput TextInput { get; set; } + /// task parameters. + public LanguageDetectionActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.Serialization.cs new file mode 100644 index 0000000000000..fbdf71680c91f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextPiiEntitiesRecognitionInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextPiiEntitiesRecognitionInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextPiiEntitiesRecognitionInput(document.RootElement, options); + } + + internal static TextPiiEntitiesRecognitionInput DeserializeTextPiiEntitiesRecognitionInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + PiiActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = PiiActionContent.DeserializePiiActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextPiiEntitiesRecognitionInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support writing '{options.Format}' format."); + } + } + + TextPiiEntitiesRecognitionInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextPiiEntitiesRecognitionInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextPiiEntitiesRecognitionInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextPiiEntitiesRecognitionInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextPiiEntitiesRecognitionInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.cs new file mode 100644 index 0000000000000..2241005ffc8c5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextPiiEntitiesRecognitionInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text PIIEntityRecognition task input. + public partial class TextPiiEntitiesRecognitionInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextPiiEntitiesRecognitionInput() + { + Kind = AnalyzeTextInputKind.PiiEntityRecognition; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the input documents. + /// Pii task parameters. + internal TextPiiEntitiesRecognitionInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, PiiActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the input documents. + public MultiLanguageTextInput TextInput { get; set; } + /// Pii task parameters. + public PiiActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.Serialization.cs new file mode 100644 index 0000000000000..f1954f0da90b3 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.Serialization.cs @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TextSentimentAnalysisInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TextInput)) + { + writer.WritePropertyName("analysisInput"u8); + writer.WriteObjectValue(TextInput, options); + } + if (Optional.IsDefined(ActionContent)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(ActionContent, options); + } + 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 + } + } + writer.WriteEndObject(); + } + + TextSentimentAnalysisInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextSentimentAnalysisInput(document.RootElement, options); + } + + internal static TextSentimentAnalysisInput DeserializeTextSentimentAnalysisInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MultiLanguageTextInput analysisInput = default; + SentimentAnalysisActionContent parameters = default; + AnalyzeTextInputKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("analysisInput"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + analysisInput = MultiLanguageTextInput.DeserializeMultiLanguageTextInput(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = SentimentAnalysisActionContent.DeserializeSentimentAnalysisActionContent(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextSentimentAnalysisInput(kind, serializedAdditionalRawData, analysisInput, parameters); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support writing '{options.Format}' format."); + } + } + + TextSentimentAnalysisInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTextSentimentAnalysisInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextSentimentAnalysisInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextSentimentAnalysisInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTextSentimentAnalysisInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.cs new file mode 100644 index 0000000000000..0d1485b0247e2 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TextSentimentAnalysisInput.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Contains the analyze text SentimentAnalysis task input. + public partial class TextSentimentAnalysisInput : AnalyzeTextInput + { + /// Initializes a new instance of . + public TextSentimentAnalysisInput() + { + Kind = AnalyzeTextInputKind.SentimentAnalysis; + } + + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + /// Contains the input documents. + /// Sentiment Analysis task parameters. + internal TextSentimentAnalysisInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData, MultiLanguageTextInput textInput, SentimentAnalysisActionContent actionContent) : base(kind, serializedAdditionalRawData) + { + TextInput = textInput; + ActionContent = actionContent; + } + + /// Contains the input documents. + public MultiLanguageTextInput TextInput { get; set; } + /// Sentiment Analysis task parameters. + public SentimentAnalysisActionContent ActionContent { get; set; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.Serialization.cs new file mode 100644 index 0000000000000..7ed74611b1424 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class TimeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Dates)) + { + writer.WritePropertyName("dateValues"u8); + writer.WriteStartArray(); + foreach (var item in Dates) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + TimeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TimeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTimeMetadata(document.RootElement, options); + } + + internal static TimeMetadata DeserializeTimeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dateValues = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dateValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DateValue.DeserializeDateValue(item, options)); + } + dateValues = array; + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TimeMetadata(metadataKind, serializedAdditionalRawData, dateValues ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TimeMetadata)} does not support writing '{options.Format}' format."); + } + } + + TimeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTimeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TimeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TimeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTimeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.cs new file mode 100644 index 0000000000000..113ebeccb66a7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TimeMetadata.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// A Metadata for time entity instances. + public partial class TimeMetadata : BaseMetadata + { + /// Initializes a new instance of . + internal TimeMetadata() + { + MetadataKind = MetadataKind.TimeMetadata; + Dates = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// List of date values. + internal TimeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, IReadOnlyList dates) : base(metadataKind, serializedAdditionalRawData) + { + Dates = dates; + } + + /// List of date values. + public IReadOnlyList Dates { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.Serialization.cs new file mode 100644 index 0000000000000..bff4e7014e7a1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.AI.Language.Text.Models +{ + internal static partial class TokenSentimentExtensions + { + public static string ToSerialString(this TokenSentiment value) => value switch + { + TokenSentiment.Positive => "positive", + TokenSentiment.Mixed => "mixed", + TokenSentiment.Negative => "negative", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TokenSentiment value.") + }; + + public static TokenSentiment ToTokenSentiment(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "positive")) return TokenSentiment.Positive; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "mixed")) return TokenSentiment.Mixed; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "negative")) return TokenSentiment.Negative; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TokenSentiment value."); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.cs new file mode 100644 index 0000000000000..bc07d1afc9114 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/TokenSentiment.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.AI.Language.Text.Models +{ + /// The predicted Sentiment for the sentence. + public enum TokenSentiment + { + /// Positive sentiment. + Positive, + /// Mixed sentiment. + Mixed, + /// Negative sentiment. + Negative + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.Serialization.cs new file mode 100644 index 0000000000000..2f0c01c3fc98a --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownAnalyzeTextInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + + internal static UnknownAnalyzeTextInput DeserializeUnknownAnalyzeTextInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeTextInputKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextInputKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextInput(kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextInput FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextInput(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.cs new file mode 100644 index 0000000000000..392ac3b35daf5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextInput.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of AnalyzeTextInput. + internal partial class UnknownAnalyzeTextInput : AnalyzeTextInput + { + /// Initializes a new instance of . + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextInput(AnalyzeTextInputKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextInput() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.Serialization.cs new file mode 100644 index 0000000000000..4e01712308043 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownAnalyzeTextOperationAction : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextOperationAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + + internal static UnknownAnalyzeTextOperationAction DeserializeUnknownAnalyzeTextOperationAction(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string taskName = default; + AnalyzeTextOperationActionKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationActionKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextOperationAction(taskName, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationAction IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationAction(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationAction)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextOperationAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextOperationAction(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.cs new file mode 100644 index 0000000000000..8e56936371a1f --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationAction.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of AnalyzeTextOperationAction. + internal partial class UnknownAnalyzeTextOperationAction : AnalyzeTextOperationAction + { + /// Initializes a new instance of . + /// task name. + /// The kind of task to perform. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextOperationAction(string name, AnalyzeTextOperationActionKind kind, IDictionary serializedAdditionalRawData) : base(name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextOperationAction() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.Serialization.cs new file mode 100644 index 0000000000000..7f9d3b629dff4 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownAnalyzeTextOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("lastUpdateDateTime"u8); + writer.WriteStringValue(LastUpdateDateTime, "O"); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("taskName"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AnalyzeTextOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + + internal static UnknownAnalyzeTextOperationResult DeserializeUnknownAnalyzeTextOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset lastUpdateDateTime = default; + TextActionState status = default; + string taskName = default; + AnalyzeTextOperationResultsKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lastUpdateDateTime"u8)) + { + lastUpdateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new TextActionState(property.Value.GetString()); + continue; + } + if (property.NameEquals("taskName"u8)) + { + taskName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextOperationResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextOperationResult(lastUpdateDateTime, status, taskName, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextOperationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextOperationResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.cs new file mode 100644 index 0000000000000..2a6dbdc72bf8e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextOperationResult.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of AnalyzeTextOperationResult. + internal partial class UnknownAnalyzeTextOperationResult : AnalyzeTextOperationResult + { + /// Initializes a new instance of . + /// The last updated time in UTC for the task. + /// The status of the task at the mentioned last update time. + /// task name. + /// Kind of the task. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextOperationResult(DateTimeOffset lastUpdateDateTime, TextActionState status, string name, AnalyzeTextOperationResultsKind kind, IDictionary serializedAdditionalRawData) : base(lastUpdateDateTime, status, name, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextOperationResult() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.Serialization.cs new file mode 100644 index 0000000000000..5aa2b54e62f23 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownAnalyzeTextResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + AnalyzeTextResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + + internal static UnknownAnalyzeTextResult DeserializeUnknownAnalyzeTextResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AnalyzeTextResultsKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AnalyzeTextResultsKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownAnalyzeTextResult(kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support writing '{options.Format}' format."); + } + } + + AnalyzeTextResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAnalyzeTextResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AnalyzeTextResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAnalyzeTextResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAnalyzeTextResult(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.cs new file mode 100644 index 0000000000000..683788e42ca59 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownAnalyzeTextResult.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of AnalyzeTextResult. + internal partial class UnknownAnalyzeTextResult : AnalyzeTextResult + { + /// Initializes a new instance of . + /// The kind of task result. + /// Keeps track of any properties unknown to the library. + internal UnknownAnalyzeTextResult(AnalyzeTextResultsKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownAnalyzeTextResult() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.Serialization.cs new file mode 100644 index 0000000000000..db78f2f7eefc9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownBaseMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + BaseMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBaseMetadata(document.RootElement, options); + } + + internal static UnknownBaseMetadata DeserializeUnknownBaseMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MetadataKind metadataKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownBaseMetadata(metadataKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support writing '{options.Format}' format."); + } + } + + BaseMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBaseMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BaseMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownBaseMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownBaseMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.cs new file mode 100644 index 0000000000000..d10e85e56ba92 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownBaseMetadata.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of BaseMetadata. + internal partial class UnknownBaseMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownBaseMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData) : base(metadataKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownBaseMetadata() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.Serialization.cs new file mode 100644 index 0000000000000..08a50966ad535 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownEntityComponentInformation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("entityComponentKind"u8); + writer.WriteStringValue(EntityComponentKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EntityComponentInformation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + + internal static UnknownEntityComponentInformation DeserializeUnknownEntityComponentInformation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EntityComponentKind entityComponentKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("entityComponentKind"u8)) + { + entityComponentKind = new EntityComponentKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownEntityComponentInformation(entityComponentKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support writing '{options.Format}' format."); + } + } + + EntityComponentInformation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityComponentInformation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityComponentInformation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownEntityComponentInformation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownEntityComponentInformation(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.cs new file mode 100644 index 0000000000000..d579fc5b8b64e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityComponentInformation.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of EntityComponentInformation. + internal partial class UnknownEntityComponentInformation : EntityComponentInformation + { + /// Initializes a new instance of . + /// Kind of entity component. + /// Keeps track of any properties unknown to the library. + internal UnknownEntityComponentInformation(EntityComponentKind entityComponentKind, IDictionary serializedAdditionalRawData) : base(entityComponentKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownEntityComponentInformation() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.Serialization.cs new file mode 100644 index 0000000000000..99e664edc992e --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + internal partial class UnknownEntityOverlapPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + 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 + } + } + writer.WriteEndObject(); + } + + EntityOverlapPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + + internal static UnknownEntityOverlapPolicy DeserializeUnknownEntityOverlapPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PolicyKind policyKind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyKind"u8)) + { + policyKind = new PolicyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownEntityOverlapPolicy(policyKind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support writing '{options.Format}' format."); + } + } + + EntityOverlapPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEntityOverlapPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EntityOverlapPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownEntityOverlapPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownEntityOverlapPolicy(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.cs new file mode 100644 index 0000000000000..19f47665f83f6 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/UnknownEntityOverlapPolicy.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Unknown version of EntityOverlapPolicy. + internal partial class UnknownEntityOverlapPolicy : EntityOverlapPolicy + { + /// Initializes a new instance of . + /// The entity OverlapPolicy object kind. + /// Keeps track of any properties unknown to the library. + internal UnknownEntityOverlapPolicy(PolicyKind policyKind, IDictionary serializedAdditionalRawData) : base(policyKind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownEntityOverlapPolicy() + { + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.Serialization.cs new file mode 100644 index 0000000000000..85e92624bf5d7 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class VolumeMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + VolumeMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVolumeMetadata(document.RootElement, options); + } + + internal static VolumeMetadata DeserializeVolumeMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + VolumeUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new VolumeUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VolumeMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support writing '{options.Format}' format."); + } + } + + VolumeMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVolumeMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VolumeMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VolumeMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeVolumeMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.cs new file mode 100644 index 0000000000000..f44b4296ac193 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Volume entity Metadata model. + public partial class VolumeMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for volume. + internal VolumeMetadata(double value, VolumeUnit unit) + { + MetadataKind = MetadataKind.VolumeMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for volume. + internal VolumeMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, VolumeUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal VolumeMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for volume. + public VolumeUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeUnit.cs new file mode 100644 index 0000000000000..fe8826586e387 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/VolumeUnit.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The Volume Unit of measurement. + public readonly partial struct VolumeUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public VolumeUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string CubicMeterValue = "CubicMeter"; + private const string CubicCentimeterValue = "CubicCentimeter"; + private const string CubicMillimeterValue = "CubicMillimeter"; + private const string HectoliterValue = "Hectoliter"; + private const string DecaliterValue = "Decaliter"; + private const string LiterValue = "Liter"; + private const string CentiliterValue = "Centiliter"; + private const string MilliliterValue = "Milliliter"; + private const string CubicYardValue = "CubicYard"; + private const string CubicInchValue = "CubicInch"; + private const string CubicFootValue = "CubicFoot"; + private const string CubicMileValue = "CubicMile"; + private const string FluidOunceValue = "FluidOunce"; + private const string TeaspoonValue = "Teaspoon"; + private const string TablespoonValue = "Tablespoon"; + private const string PintValue = "Pint"; + private const string QuartValue = "Quart"; + private const string CupValue = "Cup"; + private const string GillValue = "Gill"; + private const string PinchValue = "Pinch"; + private const string FluidDramValue = "FluidDram"; + private const string BarrelValue = "Barrel"; + private const string MinimValue = "Minim"; + private const string CordValue = "Cord"; + private const string PeckValue = "Peck"; + private const string BushelValue = "Bushel"; + private const string HogsheadValue = "Hogshead"; + + /// Unspecified volume unit. + public static VolumeUnit Unspecified { get; } = new VolumeUnit(UnspecifiedValue); + /// Volume unit in cubic meters. + public static VolumeUnit CubicMeter { get; } = new VolumeUnit(CubicMeterValue); + /// Volume unit in cubic centimeters. + public static VolumeUnit CubicCentimeter { get; } = new VolumeUnit(CubicCentimeterValue); + /// Volume unit in cubic millimeters. + public static VolumeUnit CubicMillimeter { get; } = new VolumeUnit(CubicMillimeterValue); + /// Volume unit in hectoliters. + public static VolumeUnit Hectoliter { get; } = new VolumeUnit(HectoliterValue); + /// Volume unit in decaliters. + public static VolumeUnit Decaliter { get; } = new VolumeUnit(DecaliterValue); + /// Volume unit in liters. + public static VolumeUnit Liter { get; } = new VolumeUnit(LiterValue); + /// Volume unit in centiliters. + public static VolumeUnit Centiliter { get; } = new VolumeUnit(CentiliterValue); + /// Volume unit in milliliters. + public static VolumeUnit Milliliter { get; } = new VolumeUnit(MilliliterValue); + /// Volume unit in cubic yards. + public static VolumeUnit CubicYard { get; } = new VolumeUnit(CubicYardValue); + /// Volume unit in cubic inches. + public static VolumeUnit CubicInch { get; } = new VolumeUnit(CubicInchValue); + /// Volume unit in cubic feet. + public static VolumeUnit CubicFoot { get; } = new VolumeUnit(CubicFootValue); + /// Volume unit in cubic miles. + public static VolumeUnit CubicMile { get; } = new VolumeUnit(CubicMileValue); + /// Volume unit in fluid ounces. + public static VolumeUnit FluidOunce { get; } = new VolumeUnit(FluidOunceValue); + /// Volume unit in teaspoons. + public static VolumeUnit Teaspoon { get; } = new VolumeUnit(TeaspoonValue); + /// Volume unit in tablespoons. + public static VolumeUnit Tablespoon { get; } = new VolumeUnit(TablespoonValue); + /// Volume unit in pints. + public static VolumeUnit Pint { get; } = new VolumeUnit(PintValue); + /// Volume unit in quarts. + public static VolumeUnit Quart { get; } = new VolumeUnit(QuartValue); + /// Volume unit in cups. + public static VolumeUnit Cup { get; } = new VolumeUnit(CupValue); + /// Volume unit in gills. + public static VolumeUnit Gill { get; } = new VolumeUnit(GillValue); + /// Volume unit in pinches. + public static VolumeUnit Pinch { get; } = new VolumeUnit(PinchValue); + /// Volume unit in fluid drams. + public static VolumeUnit FluidDram { get; } = new VolumeUnit(FluidDramValue); + /// Volume unit in barrels. + public static VolumeUnit Barrel { get; } = new VolumeUnit(BarrelValue); + /// Volume unit in minims. + public static VolumeUnit Minim { get; } = new VolumeUnit(MinimValue); + /// Volume unit in cords. + public static VolumeUnit Cord { get; } = new VolumeUnit(CordValue); + /// Volume unit in pecks. + public static VolumeUnit Peck { get; } = new VolumeUnit(PeckValue); + /// Volume unit in bushels. + public static VolumeUnit Bushel { get; } = new VolumeUnit(BushelValue); + /// Volume unit in hogsheads. + public static VolumeUnit Hogshead { get; } = new VolumeUnit(HogsheadValue); + /// Determines if two values are the same. + public static bool operator ==(VolumeUnit left, VolumeUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(VolumeUnit left, VolumeUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator VolumeUnit(string value) => new VolumeUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is VolumeUnit other && Equals(other); + /// + public bool Equals(VolumeUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WarningCode.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WarningCode.cs new file mode 100644 index 0000000000000..558461c90d2ee --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WarningCode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// 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 string to a . + public static implicit operator WarningCode(string value) => new WarningCode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WarningCode other && Equals(other); + /// + public bool Equals(WarningCode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.Serialization.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.Serialization.cs new file mode 100644 index 0000000000000..8995f75c58945 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Language.Text.Models +{ + public partial class WeightMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeightMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value); + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.ToString()); + writer.WritePropertyName("metadataKind"u8); + writer.WriteStringValue(MetadataKind.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + WeightMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WeightMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWeightMetadata(document.RootElement, options); + } + + internal static WeightMetadata DeserializeWeightMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double value = default; + WeightUnit unit = default; + MetadataKind metadataKind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = new WeightUnit(property.Value.GetString()); + continue; + } + if (property.NameEquals("metadataKind"u8)) + { + metadataKind = new MetadataKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WeightMetadata(metadataKind, serializedAdditionalRawData, value, unit); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WeightMetadata)} does not support writing '{options.Format}' format."); + } + } + + WeightMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWeightMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WeightMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WeightMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightMetadata(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.cs new file mode 100644 index 0000000000000..d4831cc942de9 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightMetadata.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Language.Text.Models +{ + /// Represents the Weight ) entity Metadata model. + public partial class WeightMetadata : BaseMetadata + { + /// Initializes a new instance of . + /// The numeric value that the extracted text denotes. + /// Unit of measure for weight. + internal WeightMetadata(double value, WeightUnit unit) + { + MetadataKind = MetadataKind.WeightMetadata; + Value = value; + Unit = unit; + } + + /// Initializes a new instance of . + /// The entity Metadata object kind. + /// Keeps track of any properties unknown to the library. + /// The numeric value that the extracted text denotes. + /// Unit of measure for weight. + internal WeightMetadata(MetadataKind metadataKind, IDictionary serializedAdditionalRawData, double value, WeightUnit unit) : base(metadataKind, serializedAdditionalRawData) + { + Value = value; + Unit = unit; + } + + /// Initializes a new instance of for deserialization. + internal WeightMetadata() + { + } + + /// The numeric value that the extracted text denotes. + public double Value { get; } + /// Unit of measure for weight. + public WeightUnit Unit { get; } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightUnit.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightUnit.cs new file mode 100644 index 0000000000000..f3577dded2213 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/Models/WeightUnit.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Language.Text.Models +{ + /// The weight Unit of measurement. + public readonly partial struct WeightUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WeightUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UnspecifiedValue = "Unspecified"; + private const string KilogramValue = "Kilogram"; + private const string GramValue = "Gram"; + private const string MilligramValue = "Milligram"; + private const string GallonValue = "Gallon"; + private const string MetricTonValue = "MetricTon"; + private const string TonValue = "Ton"; + private const string PoundValue = "Pound"; + private const string OunceValue = "Ounce"; + private const string GrainValue = "Grain"; + private const string PennyWeightValue = "PennyWeight"; + private const string LongTonBritishValue = "LongTonBritish"; + private const string ShortTonUsValue = "ShortTonUS"; + private const string ShortHundredWeightUsValue = "ShortHundredWeightUS"; + private const string StoneValue = "Stone"; + private const string DramValue = "Dram"; + + /// Unspecified weight unit. + public static WeightUnit Unspecified { get; } = new WeightUnit(UnspecifiedValue); + /// Weight unit in kilograms. + public static WeightUnit Kilogram { get; } = new WeightUnit(KilogramValue); + /// Weight unit in grams. + public static WeightUnit Gram { get; } = new WeightUnit(GramValue); + /// Weight unit in milligrams. + public static WeightUnit Milligram { get; } = new WeightUnit(MilligramValue); + /// Volume unit in gallons. + public static WeightUnit Gallon { get; } = new WeightUnit(GallonValue); + /// Weight unit in metric tons. + public static WeightUnit MetricTon { get; } = new WeightUnit(MetricTonValue); + /// Weight unit in tons. + public static WeightUnit Ton { get; } = new WeightUnit(TonValue); + /// Weight unit in pounds. + public static WeightUnit Pound { get; } = new WeightUnit(PoundValue); + /// Weight unit in ounces. + public static WeightUnit Ounce { get; } = new WeightUnit(OunceValue); + /// Weight unit in grains. + public static WeightUnit Grain { get; } = new WeightUnit(GrainValue); + /// Weight unit in pennyweights. + public static WeightUnit PennyWeight { get; } = new WeightUnit(PennyWeightValue); + /// Weight unit in long tons (British). + public static WeightUnit LongTonBritish { get; } = new WeightUnit(LongTonBritishValue); + /// Weight unit in short tons (US). + public static WeightUnit ShortTonUs { get; } = new WeightUnit(ShortTonUsValue); + /// Weight unit in short hundredweights (US). + public static WeightUnit ShortHundredWeightUs { get; } = new WeightUnit(ShortHundredWeightUsValue); + /// Weight unit in stones. + public static WeightUnit Stone { get; } = new WeightUnit(StoneValue); + /// Weight unit in drams. + public static WeightUnit Dram { get; } = new WeightUnit(DramValue); + /// Determines if two values are the same. + public static bool operator ==(WeightUnit left, WeightUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WeightUnit left, WeightUnit right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator WeightUnit(string value) => new WeightUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WeightUnit other && Equals(other); + /// + public bool Equals(WeightUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs new file mode 100644 index 0000000000000..4e09e9f0b7221 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClient.cs @@ -0,0 +1,597 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure.AI.Language.Text.Models; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.AI.Language.Text +{ + // Data plane generated client. + /// The language service API is a suite of natural language processing (NLP) skills built with best-in-class Microsoft machine learning algorithms. The API can be used to analyze unstructured text for tasks such as sentiment analysis, key phrase extraction, language detection and question answering. Further documentation can be found in <a href=\"https://docs.microsoft.com/azure/cognitive-services/language-service/overview\">https://docs.microsoft.com/azure/cognitive-services/language-service/overview</a>.0. + public partial class TextAnalysisClient + { + private const string AuthorizationHeader = "Ocp-Apim-Subscription-Key"; + private readonly AzureKeyCredential _keyCredential; + private static readonly string[] AuthorizationScopes = new string[] { "https://cognitiveservices.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of TextAnalysisClient for mocking. + protected TextAnalysisClient() + { + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// or is null. + public TextAnalysisClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new TextAnalysisClientOptions()) + { + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// or is null. + public TextAnalysisClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new TextAnalysisClientOptions()) + { + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public TextAnalysisClient(Uri endpoint, AzureKeyCredential credential, TextAnalysisClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new TextAnalysisClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _keyCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Initializes a new instance of TextAnalysisClient. + /// Supported Cognitive Services endpoint (e.g., https://<resource-name>.api.cognitiveservices.azure.com). + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public TextAnalysisClient(Uri endpoint, TokenCredential credential, TextAnalysisClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new TextAnalysisClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Request text analysis over a collection of documents. + /// The input documents to analyze. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> AnalyzeTextAsync(AnalyzeTextInput analyzeTextInput, bool? showStatistics = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(analyzeTextInput, nameof(analyzeTextInput)); + + using RequestContent content = analyzeTextInput.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeTextAsync(content, showStatistics, context).ConfigureAwait(false); + return Response.FromValue(AnalyzeTextResult.FromResponse(response), response); + } + + /// Request text analysis over a collection of documents. + /// The input documents to analyze. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The cancellation token to use. + /// is null. + /// + public virtual Response AnalyzeText(AnalyzeTextInput analyzeTextInput, bool? showStatistics = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(analyzeTextInput, nameof(analyzeTextInput)); + + using RequestContent content = analyzeTextInput.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeText(content, showStatistics, context); + return Response.FromValue(AnalyzeTextResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Request text analysis over a collection of documents. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AnalyzeTextAsync(RequestContent content, bool? showStatistics = null, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeText"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextRequest(content, showStatistics, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Request text analysis over a collection of documents. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AnalyzeText(RequestContent content, bool? showStatistics = null, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeText"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextRequest(content, showStatistics, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get analysis status and results. + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The cancellation token to use. + /// Get the status of an analysis job. A job can consist of one or more tasks. After all tasks succeed, the job transitions to the succeeded state and results are available for each task. + /// + public virtual async Task> AnalyzeTextOperationStatusAsync(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeTextOperationStatusAsync(jobId, showStats, top, skip, context).ConfigureAwait(false); + return Response.FromValue(AnalyzeTextOperationState.FromResponse(response), response); + } + + /// Get analysis status and results. + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The cancellation token to use. + /// Get the status of an analysis job. A job can consist of one or more tasks. After all tasks succeed, the job transitions to the succeeded state and results are available for each task. + /// + public virtual Response AnalyzeTextOperationStatus(Guid jobId, bool? showStats = null, int? top = null, int? skip = null, CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeTextOperationStatus(jobId, showStats, top, skip, context); + return Response.FromValue(AnalyzeTextOperationState.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get analysis status and results + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AnalyzeTextOperationStatusAsync(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextOperationStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextOperationStatusRequest(jobId, showStats, top, skip, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get analysis status and results + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// job ID. + /// (Optional) if set to true, response will contain request and document level statistics. + /// The maximum number of resources to return from the collection. + /// An offset into the collection of the first resource to be returned. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AnalyzeTextOperationStatus(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextOperationStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextOperationStatusRequest(jobId, showStats, top, skip, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Contains the input to be analyzed. + /// List of tasks to be performed as part of the LRO. + /// Name for the task. + /// Default language to use for records requesting automatic language detection. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task AnalyzeTextSubmitOperationAsync(WaitUntil waitUntil, MultiLanguageTextInput textInput, IEnumerable actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(textInput, nameof(textInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + AnalyzeTextOperationInput analyzeTextOperationInput = new AnalyzeTextOperationInput(displayName, textInput, actions.ToList(), defaultLanguage, null); + RequestContext context = FromCancellationToken(cancellationToken); + return await AnalyzeTextSubmitOperationAsync(waitUntil, analyzeTextOperationInput.ToRequestContent(), context).ConfigureAwait(false); + } + + /// Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Contains the input to be analyzed. + /// List of tasks to be performed as part of the LRO. + /// Name for the task. + /// Default language to use for records requesting automatic language detection. + /// The cancellation token to use. + /// or is null. + /// + public virtual Operation AnalyzeTextSubmitOperation(WaitUntil waitUntil, MultiLanguageTextInput textInput, IEnumerable actions, string displayName = null, string defaultLanguage = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(textInput, nameof(textInput)); + Argument.AssertNotNull(actions, nameof(actions)); + + AnalyzeTextOperationInput analyzeTextOperationInput = new AnalyzeTextOperationInput(displayName, textInput, actions.ToList(), defaultLanguage, null); + RequestContext context = FromCancellationToken(cancellationToken); + return AnalyzeTextSubmitOperation(waitUntil, analyzeTextOperationInput.ToRequestContent(), context); + } + + /// + /// [Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task AnalyzeTextSubmitOperationAsync(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextSubmitOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextSubmitOperationRequest(content, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextSubmitOperation", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Submit a collection of text documents for analysis. Specify one or more unique tasks to be executed as a long-running operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation AnalyzeTextSubmitOperation(WaitUntil waitUntil, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextSubmitOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextSubmitOperationRequest(content, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextSubmitOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Cancel a long-running Text Analysis job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The job ID to cancel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task AnalyzeTextCancelOperationAsync(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextCancelOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextCancelOperationRequest(jobId, context); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Cancel a long-running Text Analysis job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The job ID to cancel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation AnalyzeTextCancelOperation(WaitUntil waitUntil, Guid jobId, RequestContext context = null) + { + using var scope = ClientDiagnostics.CreateScope("TextAnalysisClient.AnalyzeTextCancelOperation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeTextCancelOperationRequest(jobId, context); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "TextAnalysisClient.AnalyzeTextCancelOperation", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateAnalyzeTextRequest(RequestContent content, bool? showStatistics, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/:analyze-text", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (showStatistics != null) + { + uri.AppendQuery("showStats", showStatistics.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAnalyzeTextOperationStatusRequest(Guid jobId, bool? showStats, int? top, int? skip, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/analyze-text/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (showStats != null) + { + uri.AppendQuery("showStats", showStats.Value, true); + } + if (top != null) + { + uri.AppendQuery("top", top.Value, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateAnalyzeTextSubmitOperationRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/analyze-text/jobs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAnalyzeTextCancelOperationRequest(Guid jobId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/language", false); + uri.AppendPath("/analyze-text/jobs/", false); + uri.AppendPath(jobId, true); + uri.AppendPath(":cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier202; + private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs new file mode 100644 index 0000000000000..b6d48331233c1 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Generated/TextAnalysisClientOptions.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.AI.Language.Text +{ + /// Client options for TextAnalysisClient. + public partial class TextAnalysisClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2023_11_15_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-05-01". + V2022_05_01 = 1, + /// Service version "2023-04-01". + V2023_04_01 = 2, + /// Service version "2023-11-15-preview". + V2023_11_15_Preview = 3, + } + + internal string Version { get; } + + /// Initializes new instance of TextAnalysisClientOptions. + public TextAnalysisClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_05_01 => "2022-05-01", + ServiceVersion.V2023_04_01 => "2023-04-01", + ServiceVersion.V2023_11_15_Preview => "2023-11-15-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..5898c43ced6bb --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.AI.Language.Text.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj new file mode 100644 index 0000000000000..332b4c607ae0d --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Azure.AI.Language.Text.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs new file mode 100644 index 0000000000000..dfc14ff4afdd5 --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tests/Generated/Samples/Samples_TextAnalysisClient.cs @@ -0,0 +1,640 @@ +// 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.AI.Language.Text.Models; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.AI.Language.Text.Samples +{ + public partial class Samples_TextAnalysisClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "DynamicClassification", + }); + Response response = client.AnalyzeText(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "DynamicClassification", + }); + Response response = await client.AnalyzeTextAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput(); + Response response = client.AnalyzeText(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput(); + Response response = await client.AnalyzeTextAsync(analyzeTextInput); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "DynamicClassification", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "", +text = "", +language = "", +} + }, + }, + parameters = new + { + loggingOptOut = true, + modelVersion = "", + classificationType = "Multi", + categories = new object[] + { +"" + }, + }, + }); + Response response = client.AnalyzeText(content, showStatistics: true); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + kind = "DynamicClassification", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "", +text = "", +language = "", +} + }, + }, + parameters = new + { + loggingOptOut = true, + modelVersion = "", + classificationType = "Multi", + categories = new object[] + { +"" + }, + }, + }); + Response response = await client.AnalyzeTextAsync(content, showStatistics: true); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeText_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput + { + TextInput = new MultiLanguageTextInput + { + Documents = {new MultiLanguageInput("", "") +{ +Language = "", +}}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "" }) + { + LoggingOptOut = true, + ModelVersion = "", + ClassificationType = ClassificationType.Multi, + }, + }; + Response response = client.AnalyzeText(analyzeTextInput, showStatistics: true); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeText_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + AnalyzeTextInput analyzeTextInput = new TextDynamicClassificationInput + { + TextInput = new MultiLanguageTextInput + { + Documents = {new MultiLanguageInput("", "") +{ +Language = "", +}}, + }, + ActionContent = new DynamicClassificationActionContent(new string[] { "" }) + { + LoggingOptOut = true, + ModelVersion = "", + ClassificationType = ClassificationType.Multi, + }, + }; + Response response = await client.AnalyzeTextAsync(analyzeTextInput, showStatistics: true); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("completed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("failed").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("inProgress").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("total").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, 1234, 1234, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("nextLink").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()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), true, 1234, 1234, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("createdDateTime").ToString()); + Console.WriteLine(result.GetProperty("expirationDateTime").ToString()); + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("lastUpdatedDateTime").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("details").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("errors")[0].GetProperty("innererror").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("nextLink").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()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("lastUpdateDateTime").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("taskName").ToString()); + Console.WriteLine(result.GetProperty("tasks").GetProperty("items")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("documentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("validDocumentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("erroneousDocumentsCount").ToString()); + Console.WriteLine(result.GetProperty("statistics").GetProperty("transactionsCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = client.AnalyzeTextOperationStatus(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true, top: 1234, skip: 1234); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AnalyzeTextJobState_AnalyzeTextOperationStatus_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Response response = await client.AnalyzeTextOperationStatusAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), showStats: true, top: 1234, skip: 1234); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new object(), + tasks = new object[] + { +new +{ +kind = "CustomEntityRecognition", +} + }, + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + analysisInput = new object(), + tasks = new object[] + { +new +{ +kind = "CustomEntityRecognition", +} + }, + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput(); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomEntitiesOperationAction() + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput(); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomEntitiesOperationAction() + }); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "", +text = "", +language = "", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomEntityRecognition", +parameters = new +{ +loggingOptOut = true, +projectName = "", +deploymentName = "", +stringIndexType = "TextElements_v8", +}, +taskName = "", +} + }, + defaultLanguage = "", + }); + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + displayName = "", + analysisInput = new + { + documents = new object[] + { +new +{ +id = "", +text = "", +language = "", +} + }, + }, + tasks = new object[] + { +new +{ +kind = "CustomEntityRecognition", +parameters = new +{ +loggingOptOut = true, +projectName = "", +deploymentName = "", +stringIndexType = "TextElements_v8", +}, +taskName = "", +} + }, + defaultLanguage = "", + }); + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, content); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextSubmitOperation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + Documents = {new MultiLanguageInput("", "") +{ +Language = "", +}}, + }; + Operation operation = client.AnalyzeTextSubmitOperation(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomEntitiesOperationAction +{ +ActionContent = new CustomEntitiesActionContent("", "") +{ +LoggingOptOut = true, +StringIndexType = StringIndexType.TextElementsV8, +}, +Name = "", +} + }, displayName: "", defaultLanguage: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextSubmitOperation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + MultiLanguageTextInput textInput = new MultiLanguageTextInput + { + Documents = {new MultiLanguageInput("", "") +{ +Language = "", +}}, + }; + Operation operation = await client.AnalyzeTextSubmitOperationAsync(WaitUntil.Completed, textInput, new AnalyzeTextOperationAction[] + { +new CustomEntitiesOperationAction +{ +ActionContent = new CustomEntitiesActionContent("", "") +{ +LoggingOptOut = true, +StringIndexType = StringIndexType.TextElementsV8, +}, +Name = "", +} + }, displayName: "", defaultLanguage: ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextCancelOperation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Operation operation = client.AnalyzeTextCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextCancelOperation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Operation operation = await client.AnalyzeTextCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Text_AnalyzeTextCancelOperation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Operation operation = client.AnalyzeTextCancelOperation(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Text_AnalyzeTextCancelOperation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + TextAnalysisClient client = new TextAnalysisClient(endpoint, credential); + + Operation operation = await client.AnalyzeTextCancelOperationAsync(WaitUntil.Completed, Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a")); + } + } +} diff --git a/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml new file mode 100644 index 0000000000000..7cb8d8d8559de --- /dev/null +++ b/sdk/textanalytics/Azure.AI.Language.AnalyzeText/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/cognitiveservices/Language.AnalyzeText +commit: 75f41e873ea0ca7adca9f4b4a9e2e60b9388a27a +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/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders.cs similarity index 59% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders.cs index b490f7fc74efc..71d5605944a42 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders.cs @@ -5,17 +5,19 @@ #nullable disable +using System; using Azure.Core; namespace Azure.AI.TextAnalytics { - internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders + internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders { private readonly Response _response; - public MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchCancelJobHeaders(Response response) + public MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders(Response response) { _response = response; } - public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; + /// 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/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders.cs similarity index 59% rename from sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs rename to sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders.cs index 30df8841a84df..5678bc06ad5a6 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders.cs @@ -5,17 +5,19 @@ #nullable disable +using System; using Azure.Core; namespace Azure.AI.TextAnalytics { - internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders + internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders { private readonly Response _response; - public MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeBatchSubmitJobHeaders(Response response) + public MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders(Response response) { _response = response; } - public string OperationLocation => _response.Headers.TryGetValue("Operation-Location", out string value) ? value : null; + /// 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/MicrosoftCognitiveLanguageServiceTextAnalysisRestClient.cs index dd0abe02bafa9..d0fb368db0f90 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisRestClient.cs +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/Generated/MicrosoftCognitiveLanguageServiceTextAnalysisRestClient.cs @@ -18,7 +18,6 @@ namespace Azure.AI.TextAnalytics internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisRestClient { private readonly HttpPipeline _pipeline; - private readonly string _endpoint; private readonly string _apiVersion; /// The ClientDiagnostics is used to provide tracing support for the client library. @@ -27,24 +26,22 @@ internal partial class MicrosoftCognitiveLanguageServiceTextAnalysisRestClient /// Initializes a new instance of MicrosoftCognitiveLanguageServiceTextAnalysisRestClient. /// 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 MicrosoftCognitiveLanguageServiceTextAnalysisRestClient(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 MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders(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 MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextSubmitJobHeaders(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 MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders(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 MicrosoftCognitiveLanguageServiceTextAnalysisAnalyzeTextCancelJobHeaders(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 8065ea334bd2e..ddfc97572d5b7 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 fe204112cebeb..6852635e6fb5f 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 762cb61b5d6e6..79998aae4ad3a 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 4ea8a0c30b627..0ec32670637ab 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 ca426f0c177ca..dcb3266b801a5 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 152956060e0f9..5194858a8a2fa 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 f4487f23d27f9..0000000000000 --- 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 fff56fe88fb98..0000000000000 --- 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 ad4a424b409aa..98063aea1cd0b 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 bb6cb9c5ac19a..f885117c5a3a2 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 95e1928f582b5..0000000000000 --- 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 76ce20ec01464..0000000000000 --- 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 96123db37230e..be77df9d56773 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 e376c81074ed3..14bf467d7916e 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 082a22ee856f7..bfb0c4a28ddad 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 453d86b5cfa71..8f99b1d672a06 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 7d2fe702a155b..fb2b23316f24b 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 c69b13f612211..86baa4564984a 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 692b3289b34a0..739b0fe3eb039 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 428ef5874f5a7..79adb45d42af2 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 8e47f382446ee..0000000000000 --- 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 572e6b49d6764..0000000000000 --- 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 3ac64583a0308..00d1d42c9a7e6 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 2d20f0e88bff4..bd0f1be828f5d 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 172f74e44e05e..10020485c219d 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 9b13dfe853c88..af6765a5c0b8c 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 5836d4c883d8e..6a29194163cfb 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 2c5b75b3c680a..240f09b209358 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 f4cf6ac92b0cf..b0b4872d36ba2 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 93943fbef12fd..e96e3183e096e 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 f465872cfd6b7..c7c94e6c21bc5 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 9ca27601cd3db..8ab523ead415a 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 7e6748a86667c..ff57e2ba2077e 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 8e42d26931788..f1c814675e961 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 9114c79af478c..22ee4f0566169 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 57e6017ac79f7..95e4c82205c0d 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 4a649acac56eb..5ebf5ef2e92f8 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 8e077790f9fee..f6b52192e1e0f 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 1678bd2cfc092..d97a10e8541a8 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 887396cf4ffdf..afa7d5a21e919 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 b5a2e06b412da..4146061ccfb07 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 9b0ce67417b8a..03b12b16e2343 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 d73f078a24174..1810f3396d589 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 c04d465f9fdb7..f3c06cefdebef 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 15ab3b54fa0a0..bb78519c545fa 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 7c60eff8c1ec7..0000000000000 --- 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 1f7ee1e77323e..0000000000000 --- 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 40777b221ac6a..60458c2c9dda1 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 3a0ec5b6f9390..d62acc2828013 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 76b88c03a1803..4d2474f8c7963 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 20e2905df3c93..141052d365b46 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 ab31af97a5146..b2f9b0ced5418 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 bfdacca2e077f..2c49360ac6406 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 3264b5bd572aa..0000000000000 --- 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 d6e4dba54305b..0000000000000 --- 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 3a230bf197fda..82fa022a91bca 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 82bb78d8afb74..1ed6d8e6739f6 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 bc605fd22f8a1..5f2483051590d 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 2e7299ab1eb18..13bfe4043af58 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 6a086149be670..21f4aff099336 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 8448c6711b87b..aa140b75ddb0b 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 4eae7cf20593b..0000000000000 --- 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 bcdc468a40399..0000000000000 --- 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 416a259e924ac..1d2d28c237381 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 cda6ff4c5749b..ed3c064d05e1a 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 5851ddde45b88..ae6a9f9494f6e 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 0a833c789cfdd..ffbe5846ef397 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 cdf62c6e47876..fe5cce2737f5d 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 5ad3caa9b5e17..60a1b50c5008e 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 967295e415ce6..0000000000000 --- 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 bc9c419600713..0000000000000 --- 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 907d468fc9152..62f10a11ee8f6 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 7881fab4631fc..bd39e70ea226e 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 5a8a5f890169d..b236f5376c227 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 d08c02aca6227..ae27fc1421b0c 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 ab1f75b856167..0000000000000 --- 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 f71905d52301b..0000000000000 --- 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 695cc18c09b81..eef9309cc49f6 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 08ed64bfb0696..46a47e245769b 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 20e261b3eaf5e..2553dc54bb6dc 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 f22a185b0dccd..fda0d735c6f9f 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 b1f9460e1b15b..d9c5f18d07a6a 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 d76d674c8b458..e3586da5e4180 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 c523cbe7254c7..933fa9ca4956f 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 04e60c0359710..79f802f2225e4 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 0364b8511622a..0000000000000 --- 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 b279a33ced9e2..0000000000000 --- 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 8fe20d837dd5c..6ce2677b229ea 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 2a40db9313b7e..bfbf737cfaf4a 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 7b3990233069a..f331420d8fd1a 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 54dd5f7dd658c..7a48d12a66f59 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 57b530540792f..efab17afcaa4c 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 61c98f1e2c117..0a2b4176b1323 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 01ea479350772..03fed56c0d355 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 b52dbbb5059b9..dbc56b69e16ca 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 fe0291a36ae2d..917500169bb55 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 91fbd76296fce..2ee758a4997be 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 434d46ac82753..a9808e6b57b8c 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 1f97f705ab8be..2ef5806de4d67 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 a48c7a1d05906..112231249fd97 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 5552a3afd3e8e..0000000000000 --- 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 f3967c70e2b93..0000000000000 --- 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 8f75a6727544f..815aa508b5d1e 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 630a89b0245ae..f2ace0f3f80ce 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 7989552ea9f58..d3fb8f6a76597 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 420973855c6ef..85c67ac8ee838 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 7e58f252e4e95..458888844a25b 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 2752ae9a1863a..9718e03c6677a 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 8171965e6d249..5c7e29245e142 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 005941113c0da..cbc7ed096c7c0 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 38b07181c0e4f..e01f5d79dcd72 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 462066aa88ba0..a7355df0ce3d3 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 31f2d0b0e8da7..e2a0d9f7d1639 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 c1fab1c9ee90e..03b41e5deb090 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 86f6eb507ddcc..bf5dd41ed2d5b 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 b590b1022d192..a9bfccdc2f504 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 b3c77501d0034..ecb29aa756c99 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 fd4d7569d2277..b9f9323a902d0 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 418d949fdcc23..fd6f839d54bfa 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 41f1f77561e13..3d69cce9e3c9c 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 cb72bb8ddc49a..bcffeaa1f59ec 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 b1ab48b6d40c6..19aa5e3bc317f 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 ab431536f82c2..07c2f26230d6f 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 d5d33a1314bfa..c8fe8dc9c26d7 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 67a7876d127ba..4f0945e0d0ab5 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 cb037b910fdc6..1ccd7cc31b4bc 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 2c618651c9317..91993a8c487c3 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 e332a526e0aee..a6e92d3210fd8 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 9f3e1f6abbd97..87aec2799cdd0 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 b06f3bcada856..d384a4bd2ce53 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 2b31607f89c42..50a0526bf22f2 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 0df65ab2cd5e0..32d18de920139 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 4b591f3831150..411c15d52d183 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 51742c2c2074c..dd37b1493331f 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 601a6f154f066..ea78fe9dd5387 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 c635b5b90ebf1..2a5571dfc5596 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 341a6c26f37ef..3a9ef9973cd88 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 ac44c57002830..e624c6fb58138 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 66ea6478a09ee..38dc0aacf3e50 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 e5418b03278dc..eae3f6e722b7a 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 3bfb87c960731..4936c352b1809 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 77f2ed8a23adc..0000000000000 --- 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 720c0df1f6d76..0000000000000 --- 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 429b0da73052e..95fafdbfc0c90 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 fa8923ccbc35e..f4c0084851b8d 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 b7f8532714c2d..5e917ea91090c 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 56144a60ae572..6a14f433c52e5 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 14db7cffe467d..c58ce7c62375f 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 d000ff1df73c4..0000000000000 --- 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 5a946ceda3e86..0000000000000 --- 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 3c49287162cbf..0000000000000 --- 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 4707ac6907128..391531baf2d29 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 0495e8e0d39c4..e5dd728041efc 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 9a18b1cdec2c8..7c3df0a2da3f0 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 3eefccf80f417..902348de6166b 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 87a229594758a..96986895ab3d4 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 be4b64fa6a239..e44cbe2ea1c04 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 43f521b57ded3..0000000000000 --- 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 8fd9f64c80387..0000000000000 --- 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 781004f9a2793..8533f567e7c05 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 2f6e46625b590..9914ada47ea74 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 ad15c30cbf9d1..297f599ca3204 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 8998948837e00..e9e7c069f0c92 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 27028fba1dc90..7016316f01b7d 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 07c2d5d4862c2..434edbe48383a 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 67a7e4b678eeb..0407221003f5e 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 4634a8485eed8..7931800b922df 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 7c6064b09af89..65c4797bd555e 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 e4093356bfc1f..9e22b7df2601a 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 d89965fe92e28..06a8a295ed491 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 59805e47ffacd..704b7e30d4d69 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 6818652cc9881..deb049dca54f0 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 fb2c671688271..96888c6691fc7 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 785a0b7750967..0de3528c8f1e3 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 424d0a3f02bf7..8fefd4d13cad0 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 7b13319e23d4b..dee74d102e1b8 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 9778691e8590d..a361b623b453d 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 c21939075e3bb..27b9d15b17ca1 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 bd4359681535c..890cd4598bf3e 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 66d3dbeb8d490..7faca36a6cb73 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 aec998c4fee68..e453f3e4477a7 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 e6624237d38e7..0000000000000 --- 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 e8251cab78b3f..944c72afd8e7d 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 1fef163b58139..239f1af34b710 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 60f03b9349c0d..7afd45282fcfc 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 0a21a9c0693ef..f5ba7b2d02c24 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 ca87d6353d0f2..49a08ff413c62 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 601633ae74577..e49fc1a316562 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 30b4acd4783db..728f963e02f28 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 4ac52d7a7574f..eae8fecc5d4bf 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 3b983c83e6f19..5e3e2c61bdc63 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 63641ab154b71..babe90ff642a9 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 9476d66dff708..0000000000000 --- 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 8b2c631c22e55..0000000000000 --- 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 6aba4a44c028e..8aee46becce15 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 325ba1d66c473..757d486ccc5ed 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 71c5c8988e983..aff5c9bb87d40 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 c8c75f63edf3e..0000000000000 --- 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 cfd4c1ba808fe..0000000000000 --- 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 11813a8a4536f..0000000000000 --- 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 e119c77bd0bf0..0000000000000 --- 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 8276d74414b66..fed47d77ef222 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 25db6ebf0fe36..f206ce23a158e 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 5e1d5d4c7a871..9e1860075e6b5 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 737eb6bdb7408..2565ea04a8df4 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 b75fcfe947ceb..c944f11187597 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 73252692663be..e5de45e4f1228 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 55fc1c4edbd9b..3c850cde59a24 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 355069753eab6..ede5561b5f2dc 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 213e6c31ae3c9..5d35165c5857a 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 3396cd7fc1e6c..ec67b9bc64bc7 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 70f8556d4def5..6bf1bb64348be 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 7a819363e8a23..cf551aa541836 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 d9c1ed6834965..92306369dc74d 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 5f023dbc68211..1e8d07f07281e 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 9531872eea2f6..5b370a5300b30 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 3074c6ef1bc14..cf8b295d17a52 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 33effafc14924..4624223ede4d9 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 f17f6a25145a5..6ac55985f2ea3 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 431a7d6b618b1..0000000000000 --- 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 77c87ba5f70a9..0000000000000 --- 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 c79d8c04f9fe0..b9f2fbba10320 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 5cefae9f2cde5..4d5b907ac8796 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 bd46b71bfacc9..cdbcede3cca45 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 488f7f8cdde5d..e830a89b8e85a 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 c65f4729a64c7..4b82ff9ffa0ed 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 a5fd885e39e78..16ffd92b88562 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 f373d0a9d3cec..78bd26bf3f0e4 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 a595cedd0ca01..7959443414ea0 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 b5f499224ac66..0000000000000 --- 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 f78d1e8a48e8e..0000000000000 --- 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 3c281c4bc939e..0000000000000 --- 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 495f0fe7e6260..0000000000000 --- 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 414966c13e587..0000000000000 --- 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 ba59841c47751..0000000000000 --- 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 1095e91649ae1..00d3118e34305 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 dfb2aaacde11e..f25e08b0c8747 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 36b44f167d4e2..0000000000000 --- 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 1d37bb1bebd04..0000000000000 --- 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 77fa1354eb547..5f3f1b2175e53 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 028d17db1a0cc..08909f1aa57da 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 2db251fd6f75e..ee0f738f46475 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 85560ae955654..99b5acf2e99cb 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 c0cd7664f0b08..165b2f79f81b5 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 93294168dcee6..0000000000000 --- 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 97ce51e05c787..0000000000000 --- 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 3dcb18adc922b..e60bd7fb241f8 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 9556c557bacba..69e607e9fa492 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 d94ea8061331f..734fc35923294 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/75f41e873ea0ca7adca9f4b4a9e2e60b9388a27a/specification/cognitiveservices/data-plane/Language/stable/2023-04-01/analyzetext.json generation1-convenience-client: true ```